Open DivadNojnarg opened 1 year ago
Hello,
There must be something else here. {packer} doesn't change the way html dependencies are handled for htmlwidgets.
These 3 tests works fine for me (restarting session between testing them) :
library(shiny)
library(toastui)
ui <- fluidPage(
actionButton("test1", "Test 1"),
actionButton("test2", "Test 2"),
actionButton("test3", "Test 3"),
tags$div(id = "placeholder")
)
server <- function(input, output, session) {
observeEvent(input$test1, {
insertUI(
selector = "#placeholder",
ui = tagList(
datagrid(rolling_stones_50)
)
)
})
observeEvent(input$test2, {
insertUI(
selector = "#placeholder",
ui = tagList(
renderDatagrid({
datagrid(rolling_stones_50)
})
)
)
})
observeEvent(input$test3, {
insertUI(
selector = "#placeholder",
ui = tagList(
datagridOutput("grid")
)
)
})
output$grid <- renderDatagrid({
datagrid(rolling_stones_50)
})
}
shinyApp(ui, server)
Nonetheless I think that's better if dependencies are loaded when app is initialized.
Yes also working for me with these examples. It could be a bad JS timing issue on my side, the app being more complex. The only concern about preloading deps even when the widget is not initially here is the app starting time which could be impacted.
Hi Victor,
When using insertUI within a golem modularised app, I end up with:
on the JS side. After few investigations, I realised that the JS dependencies for toastui are not available in the HTML inspector source tab, like they traditionally do for other tools: .
This is maybe related to how packer handle dependencies by not using
htmlDependency
. I manually have to do this to get it working, which is not very convenient:which is nearly the same as doing
use_waiter
above.I don't know how you want to handle this, create a
use_toastui
or see with John if this can be changed in packer.