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

"No model found for id {x}" when rendering dynamically #108

Open
jcheng5 opened this issue Oct 19, 2023 · 1 comment
Open

"No model found for id {x}" when rendering dynamically #108

jcheng5 opened this issue Oct 19, 2023 · 1 comment

Comments

@jcheng5
Copy link
Collaborator

jcheng5 commented Oct 19, 2023

  • shinywidgets version: 0.2.1
  • Python version: 3.10
  • Operating System: macOS 13.6

Description

With this app I was trying to have a widget returned from a UI output. But no widget appears, and there's a JS error saying "No model found for id {whatever}".

It looks to me like the fact that the widget registration happens before the output_widget is bound, is something shinywidgets didn't expect?

@cpsievert
Copy link
Collaborator

cpsievert commented Oct 19, 2023

For now, you can workaround this problem by statically rendering output_widget()'s HTML dependencies, for example:

app_ui = ui.page_fluid(
    output_widget("foo").get_dependencies(),
    ui.output_ui("dynamic_ui"),
    ui.output_text("value")
)

I haven't looked deeply yet at what is causing this, but based on the fact that the simple dynamic UI usage works fine, it seems the issue derives from register_widget() getting called before the output binding has been registered (i.e., before output_widget()s dependencies have rendered).

PS. I'm not totally sure if it'll make sense for {shinywidgets} to "just work" with this sort of usage. In the case that it doesn't, it feels like there should be a use_shinywidgets() (which would a thin wrapper around output_widget("foo").get_dependencies())...

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

No branches or pull requests

2 participants