Skip to content

Failed redraw of SharedData layer #395

Closed

Description

@cpsievert

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)

Activity

  1. added a commit that references this issue on Mar 1, 2017
    678bae1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions