Open
Description
We need another context manager, maybe ui.discard()
, to prevent Shiny Express from trying to interpret non-UI objects as UI. Or, perhaps Shiny Express should not be so strict about what kinds of objects are allowed to be displayhooked (no-op instead of error).
from shiny.express import ui
class A:
def __init__(self):
self.options = {}
def set_option(self, name, value):
self.options[name] = value
# for method chaining purposes
return self
a = A()
# This next line causes the error.
# Enclosing the line in `with ui.hold()` does not help.
a.set_option("host", "localhost")
with ui.card():
"Hello"
For now the best workaround I can think of is to turn such lines into dummy assignment statements, like _ = a.set_option("host", "localhost")
, but that is not very satisfying.
Metadata
Metadata
Assignees
Labels
No labels