Closed cegbuna closed 5 months ago
Thanks for reporting , I'll check it out.
btw did you use the CRAN version or the github version. I had made some fixes to Shiny part of search in the GH version.
I used the github version 0.2.9002 of the ‘leaflet.extras’ package
Hi bhaskarvk, Have you gotten a chance to look into this issue? Thanks
I've had a similar problem with addSearchFeature(). After searching for a marker in a leaflet map inside of a Shiny dashboard, the leaflet click event for the found marker, and all other markers, no longer works.
@bhaskarvk I'm reporting a similar issue. After performing a search, the "marker_click" event does not get fired anymore. Reproducible example:
library(shiny)
library(leaflet)
library(leaflet.extras)
ui <- fluidPage(
leafletOutput("map")
)
server <- function(input, output, session) {
data <- data.frame(lat = 20:22, lng = 30:32, name = c("first", "second", "third"))
output$map <- renderLeaflet({
leaflet(data) %>%
addTiles() %>%
addMarkers(lng = ~lng, lat = ~lat, label = ~name, group = "names") %>%
addSearchFeatures(targetGroups = "names")
})
observe({
input$map_marker_click
cat('clicked\n')
})
}
shinyApp(ui, server)
@bhaskarvk I noticed that I actually get an error in the JS console when hovering/clicking on a marker only after doing a search
@schloerke tagging for visibility of an old issue
Somehow the layer feature is being added to the value object. The layer object is very recursive.
@daattali Found it.
leaflet-search is poisoning the concept of the latlng object of the marker by adding the layer attribute. I think it will be safer to have leaflet.R fix this issue than to rely on 3rd party packages behaving properly.
Adds the .layer
property (any the many other lines like it): https://github.com/stefanocudini/leaflet-search/blob/eee9e4825a4e474961b7d48049d4621785a9fabb/src/leaflet-search.js#L539
leaflet-search is causing me more issues than any other package. :-/
Will comment when I have made a patch
Thanks @schloerke , I can confirm my sample code now works for me
But another bug is now happening! I'll report it in the PR
Works for me :) Thanks, I hope JS error report helped!
Has this been fixed in leaflet?
After searching for a marker using the addSearchFeature() function in a leaflet map in shiny, the popup argument in the addCircleMarker() function doens't fire. This isn't an issue in rstudio. Curious to know if you can replicate and look into the issue. I used the data and code from your tutorial page below to replicate issue
Thank you
http://rpubs.com/bhaskarvk/leaflet-search