Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Dock "state" out of date #49

@nbenn

Description

@nbenn

Calling dockViewR::get_dock() immediately after e.g. dockViewR::add_panel() appears to return an "out of date" result.

In an app as

library(shiny)
library(bslib)
library(dockViewR)

ui <- page_fillable(
  dockViewOutput("dock")
)

server <- function(input, output, session) {

  output$dock <- renderDockView(
    dock_view(panels = list())
  )

  observeEvent(
    get_dock("dock"),
    {
      add_panel("dock", panel("test1", "Test", tagList()))
      message("panels: ", paste0(get_panels_ids("dock"), collapse = ", "))
    },
    once = TRUE
  )
}

shinyApp(ui, server)

I don't immediately see the added panels.

  1. Would passing an arg to functions like add_panel() etc. immediate (like in shiny::insertUI() be possible/make sense?
  2. Is there a way with current functionality to tell whether there are "outstanding" changes (i.e. things what have been modified, but are not yet reflected in the "state"?

The reason I'm asking is not a real issue, but more a theoretical concern, where the dock might be modified and then very quickly serialized/saved, with the most recent modification(s) not reflected in the saved state. In "real-world" scenarios enough time most likely will pass between these two steps.

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