rstudio / leaflet

R Interface to Leaflet Maps
http://rstudio.github.io/leaflet/
Other
808 stars 507 forks source link

interactive addMarkers in shiny does not work in dev version #762

Open ds-jim opened 3 years ago

ds-jim commented 3 years ago

When trying to use addMarkers dynamically in Shiny the dev version does not work. Installing the cran version fixes this.

the below works with can leaflet, not dev leaflet. `library(shiny) library(leaflet)

ui <- fluidPage( leafletOutput('map') )

server <- function(input, output, session) { output$map <- renderLeaflet({leaflet()%>%addTiles()})

observeEvent(input$map_click, { click = input$map_click leafletProxy('map')%>%addMarkers(lng = click$lng, lat = click$lat) }) }

shinyApp(ui, server)`

jcheng5 commented 3 years ago

Hmmm. This works fine for me. What do you see in your JavaScript console when it fails?

ds-jim commented 3 years ago

Hope this helps? Screenshot 2021-10-08 at 09 55 46

jcheng5 commented 3 years ago

Yikes. Can you try the following:

  1. Ensure the devtools package is installed (doesn't matter what version)
  2. Start with a fresh R session
  3. Run your reproducible example above, ensure that it fails as expected
  4. In the same R session, run devtools::session_info() and reply with the results

Thanks!