Open
Description
Category
UI Components
Scope
Quality of Life
Problem
When restoring from a bookmark, I only have access to input values via shiny.bookmark.restore_value(resolved_id, default)
.
I'd like access to the values stored in the URL.
Solution
Something similar to:
def restore_value(resolved_id: ResolvedId, default: Any) -> Any:
# Requires a domain or restore context
ctx = get_current_restore_context()
if isinstance(ctx, RestoreContext):
return ctx.values.get(resolved_id, default)
return default
Alternatives (Optional)
I don't want to use get_current_restore_context()
as that function is a building block.
Example (Optional)
A user could create components similar to the fn below where the bookmark stores the context as a value and not as an input.
def custom_input_text(
id: str,
value: str = "",
) -> ui.Tag:
resolved_id = resolve_id(id)
return tags.textarea(
restore_value(resolved_id, value),
id=resolved_id,
type="text",
)
Impact (Optional)
No response
Contribution? (Optional)
Yes, I can implement (or help).