To evaluate the tree,
the function walks down bare lists (rlang::is_bare_list())
and replaces each shiny::is.reactive() by its value,
walking down that value in turn.
Everything else is a leaf, printed by its own print() method:
reactives inside a leaf, such as a classed list, stay unevaluated.
Printing never opens the viewer or a browser.
Usage
mixed_react_tree_app(...)
mixed_react_tree_ui(id)
mixed_react_tree_server(id, tree = shiny::reactive(NULL))Arguments
- ...
Arguments passed on to
module2appui_wrapperA function to wrap the resulting
shiny::tagList()in. Must yield a full shiny UI, such asshiny::basicPage()orshiny::bootstrapPage(). For maximum reusability of a module, avoid depending on the wrapper and only return "vanilla" UI.module_ui,module_serverModule functions.
ui_args,server_argsAdditional arguments passed to
module_serverandmodule_ui.server_argscan beshiny::reactive()s, if corresponding argument inmodule_serveraccepts it. Named reactiveserver_argscan change while the app runs (seemodule2app_bare()).optionsNamed options that should be passed to the
runAppcall (these can be any of the following: "port", "launch.browser", "host", "quiet", "display.mode" and "test.mode"). You can also specifywidthandheightparameters which provide a hint to the embedding environment about the ideal height/width for the app.
- id
The id string to be namespaced (optional).
- tree
A reactive- or non-reactive value, typically a deeply nested list of reactives and non-reactive values, as passed around between modules.
Details
In the simplest case, modules accept or return a single reactive- or non-reactive value. Non-reactive returns are uncommon, but allowed. In a more complex case, modules can accept or return deeply nested lists of reactives and non-reactives, including non-reactives which contain reactives. For example, consider a module to input the contact details of an arbitrary number of people, say, a travel group.
To quickly grasp what your module accepts and returns,
this module prints both the "raw", unevaluated tree
and a version of the tree with all leaves evaluated.
module2app() and module2app_bare() also export both trees as this text,
for tests and coding agents.
Functions
mixed_react_tree_app(): Test appmixed_react_tree_ui(): Module UImixed_react_tree_server(): Module Server
Changes to the Reactive Graph
Note that because this module prints all returned reactives from the tree to the UI, the reactive graph will be deeply affected. For example, these reactives might be invalidated at a different time in your use of your modules outside of this testbed.
See also
Other modules:
abort_if_reactive(),
get_screenshot_args_attr(),
module2app_bare_ui(),
module2app_ui()