-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing spinner when leafletOutput is updated through leafletProxy #17
Comments
I also have this exact same issue. |
I am also having this issue. |
Also seeking a solution. |
Same. |
Also interested. |
also interested |
I am also interested. |
Has anyone come up with a workaround? |
I used the shinyWidgets package in my shiny app. For this example I added the line shinyjs::useShinyjs() in the ui as well as a fluidRow to add a div that loads a spinner (you probably want to change the layout so it appears over the map but I'm not sure how to do that). Then I added the line shinyjs::showElement(id = 'loading') inside the observe function and before the leafletProxy call, and shinyjs::hideElement(id = 'loading') after the leafletProxy call at the end of the observe function. The spinner now shows up while the map is loading. Hope this helps! `library(shiny) ui <- fluidPage( server <- function(input, output, session) { points <- eventReactive(input$recalc, { output$map <- renderLeaflet({ observe({
}) shinyApp(ui, server)` |
The solution above is great, except it doesn't work for larger shape renderings. For example, a map of US county polygons with some aesthetic mappings will not be rendered on the screen before the spinner is removed. If anyone has a workaround, it would be wonderful to see how to work around this problem. |
When I tried running the example given, I wasn't even getting a loader to show up initially on the map. It looks like any output with the name "map" was not working #49. This is now fixed The other issue here is not seeing the loader when using the leaflet proxy. Without looking into this, I'm pretty sure it's happening because the actual plot object isn't getting recalculated. Any widget that uses a proxy to update it (leaflet, plotly, whatever else supports updating without a complete re-render) doesn't trigger a redraw from shiny, so shinycssloaders doesn't think it's recalculating. I don't know enough and haven't looked into how the leafetlet proxy works, but unless there's a signal that shiny knows the specific map is being re-plotted, I don't think this will be solved with shinycssloaders. |
Unfortunately I believe this is not an issue that can be solved with shinycssloaders. The problem is that shiny itself isn't sending a message saying that the plot is recalculating. There are specific javascript events that shiny usually fires when an output recalculates, namely |
Hi,
the package works great with
renderLeaflet
, thanks a lot! However, the spinner doesn't show up when updating the map withleafletProxy
, as illustrated by the following MWE. Do you have any advice on how to overlay a loader animation over the map while it is being updated by a call toleafletProxy
?Cheers,
Andrzej
The text was updated successfully, but these errors were encountered: