I apologize in advance but I cannot share the code that I am struggling with.
I am developing a Shiny App that is using three kind of large data.tables(18k rows x 15 columns, 66k x 21 and 300k x 15 ). The app has four tabs: the first, the default tab that opens at startup renders a Leaflet map, the others a Visnetwork, a Plot_ly timeseries and a DT, not in parallel. The initial render of the map uses renderLeaflet, while any update is done with leafletProxy.
The first data.table is filtered through a reactive function that at the same time updates the filters in a waterfall-style structure (any selectInput updates all the following selectInput, in the picture this is called "subnetwork_filter") and the other two are a filtered based on the resulting data.table (one in "edges_filter" and the other in "traff_filter"). Once everything is filtered, to make sure that they are always updated together I put them in another reactive function (the loadedVariants you can see in the picture) that returns a named list.
The weird thing is that, profiling the app to optimize performances, I found this weird gap shown in the picture where it looks like the app is going idle before actually rendering the map. This happens on startup and when any filter is selected. I also noticed that every function and every render is run twice before it actually renders. I should mention that, using smaller datasets, the same thing happens but for a much smaller time, so I never noticed it before switching to bigger, production-ready data last week.
My question is: does anybody have any idea why this is happening?
Again, sorry but I cannot share the whole code of the app and it would take too much time to clean it of the sensible stuff (the server is almost 3k lines of code).