0

The funciton addSearchGoogle from leaflet.extras is throwing this error in a Shiny-app:

Warning in renderWidget(instance) : Ignoring appended content; appendContent can't be used in a Shiny render call

The problem is this line: https://github.com/trafficonese/leaflet.extras/blob/master/R/search.R#L210

Somehow it is not possible to use this function htmlwidgets::appendContent anymore.

Does anyone know how to solve this issue? What is the new way of doing that or is that strictly forbidden now?

I tried something like this:

  map$dependencies <- c(map$dependencies,
                        leafletSearchDependencies(),
                        list(htmltools::htmlDependency(
                          "googlesearchapi", "0.0.1",
                          src = c(href = url),
                          script = "js?v=3",
                          all_files = FALSE
                        )))

But then in the browser Console i am getting warnings that "google" is not defined

1 Answer 1

0

htmltools::htmlDependency is the right approach and works as expected. The script gets appended to the end of the head tag.

The bug in the repo must be from somewhere else.

Not the answer you're looking for? Browse other questions tagged or ask your own question.