ctmm-initiative / ctmmweb

Web app for analyzing animal tracking data, built upon ctmm R package
http://biology.umd.edu/movement.html
GNU General Public License v3.0
32 stars 21 forks source link

temporary error in overlap location plot when underlying data updated #48

Closed xhdong-umd closed 6 years ago

xhdong-umd commented 6 years ago

There is a temporary error in overlap page that show up and disappear briefly in following conditions:

Then there is this error printed in console, and one line error show up in app briefly:

Warning in max(abs(v), na.rm = TRUE) : no non-missing arguments to max; returning -Inf Warning in max(abs(v), na.rm = TRUE) : no non-missing arguments to max; returning -Inf Warning: Error in f: Breaks and labels are different lengths Stack trace (innermost first): 119: f 118: self$get_labels 117: f 116: ggproto_parent(ScaleContinuous, self)$break_info 115: f 114: scale_details$break_info 113: train_cartesian 112: f 111: coord$train 110: 109: mapply 108: Map 107: f 106: layout$train_ranges 105: ggplot_build 104: ggplot_gtable 103: FUN 102: lapply 101: arrangeGrob 100: gridExtra::grid.arrange 99: renderPlot [/Users/xhdong/Projects/ctmmweb/inst/app/server.R#2061] 89: 78: plotObj 77: origRenderFunc 76: output$overlap_plot_location 1: runApp

The error is caused by the simultaneous update of plot and table, when the underlying data has changed but the plot is still using old row selection index on the new data to get the data for plot.

I didn't find a proper way to control the update order. I tried the usual method of freezeReactive and priority of observeEvent, even tried to just suppress the error, but all attempts failed.

For now I'll leave it as is since it doesn't cause problem for app, and I've spent quite some time on this (every test need a series of operations which make the develop/test loop longer).

xhdong-umd commented 6 years ago

I managed to silent the warning and error messages for the special case. That should be enough because it only happened briefly then update to correct data automatically.