Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle shiny.tag.function dependencies #72

Open
kamilzyla opened this issue Jun 26, 2023 · 0 comments
Open

Handle shiny.tag.function dependencies #72

kamilzyla opened this issue Jun 26, 2023 · 0 comments

Comments

@kamilzyla
Copy link
Collaborator

kamilzyla commented Jun 26, 2023

Goal

The behavior of this app should be equivalent whether the selectInput() is wrapped in ReactContext() or not:

shinyApp(
  ui = shiny.react:::ReactContext(
    selectInput("select", "Select", c("Apples", "Bananas"))
  ),
  server = function(input, output) {}
)

Right now it gives the following error:

Error in FUN(X[[i]], ...) : 
  Expected a recursive structure built of NULLs, lists and dependencies

Root cause

Let's take a look at deparse(selectInput("select", "Select", c("Apples", "Bananas"))):

structure(
  list(
    # Omitted for brevity.
  ),
  class = "shiny.tag",
  html_dependencies = list(
    structure(
      function() {
        if (is_shiny_app()) {
          shiny::registerThemeDependency(func)
          return(mfunc(get_current_theme()))
        }
        mfunc(bs_global_get())
      },
      class = "shiny.tag.function" # The problem
    )
  )
)

The problem boils down to this: the flattenDeps() function doesn't handle arguments of class shiny.tag.function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants