Skip to content
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

Failed redraw of SharedData layer #395

Closed
cpsievert opened this issue Mar 1, 2017 · 0 comments
Closed

Failed redraw of SharedData layer #395

cpsievert opened this issue Mar 1, 2017 · 0 comments

Comments

@cpsievert
Copy link
Contributor

If you click "redraw" in this shiny app, then try to select markers, they are not highlighted, and I receive Uncaught TypeError: Cannot read property 'layer' of undefined

library(leaflet)
library(crosstalk)
library(shiny)

qd <- SharedData$new(quakes)

ui <- fluidPage(
  actionButton("redraw", "Redraw:"),
  leafletOutput("map")
)

server <- function(input, output, session) {
  
  output$map <- renderLeaflet({
    leaflet(qd) %>% 
      addTiles() %>% 
      addCircles(group = "foo")
  })
  
  observeEvent(input$redraw, {
    leafletProxy("map", session) %>%
      clearGroup("foo") %>%
      addMarkers(data = qd)
  })
  
}

shinyApp(ui, server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant