qfes / rdeck

Deck.gl widget for R
https://qfes.github.io/rdeck
MIT License
97 stars 0 forks source link

`get_view_state` gets triggered twice on v0.5.0 #88

Closed bdbmax closed 1 year ago

bdbmax commented 1 year ago

On the latest release, a get_view_state in an observer gets triggered twice (one time with the old value, and again with the right one). You can see it when grabbing the zoom in a shinyapp:

shinyApp(
  ui = fillPage(
    rdeckOutput("map", height = "100%")
  ),

  server = function(input, output) {

    output$map <- renderRdeck({
      rdeck(initial_view_state = view_state(center =  c(-73.58, 45.53), zoom = 15)) |> 
        add_mvt_layer(id = "test",
                      data = tile_json("mapbox.mapbox-streets-v8", "mapbox"))
    })

    observe(print(get_view_state("map")$zoom))

  }
)

The bug does not happen in the release v0.4.0.

anthonynorth commented 1 year ago

Fixed in dev/latest