Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/shiny-react-upstream/5-shadcn/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"tsx": true,
"tailwind": {
"config": "",
"css": "src/styles/globals.css",
"css": "srcts/globals.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
Expand Down
3 changes: 2 additions & 1 deletion examples/shiny-react-upstream/5-shadcn/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "shiny-react-dashboard",
"name": "shiny-react-shadcn",
"private": true,
"version": "1.0.0",
"type": "module",
"description": "Interactive dashboard example using shiny-react and shadcn/ui",
Expand Down
1 change: 0 additions & 1 deletion examples/shiny-react-upstream/7-chat/py/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# Load .env file in this directory for OPENAI_API_KEY
app_dir = Path(__file__).parent
env_file = app_dir / ".env"
print(env_file)
dotenv.load_dotenv(env_file)

# Initialize chat with OpenAI GPT-4o-mini by default
Expand Down
4 changes: 2 additions & 2 deletions examples/shiny-react-upstream/8-modules/py/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ def _():
return 0

@reactive.effect
def _():
async def _():
"""Send notification message every 5 counts"""
count = input.count()
if count is not None and count > 0 and count % 5 == 0:
shinyreact.post_message(
await shinyreact.post_message(
session,
"notification",
{"message": f"Milestone reached: {count}"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ class CounterWidgetElement extends ShinyReactComponentElement {
}

if (!customElements.get("counter-widget")) {
customElements.define("counter-widget", CounterWidgetElement);
customElements.define("counter-widget", CounterWidgetElement);
}
4 changes: 4 additions & 0 deletions js/src/shiny-react/ImageOutput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export type ImageData = {
* dimension change detection (default: 400ms). Controls how long to wait
* after a resize event before sending updated dimensions to Shiny. Higher
* values reduce server load but may delay updates.
* @param props.namespace - Optional namespace override for Shiny module
* support. If provided, overrides the namespace from ShinyModuleProvider
* context. Pass `null` to explicitly disable namespacing even when inside
* a provider.
* @param props.onRecalculating - Optional callback function that gets called
* whenever the recalculation status changes. Receives a boolean indicating
* whether the image is currently recalculating.
Expand Down
9 changes: 5 additions & 4 deletions js/src/shiny-react/ShinyModuleContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ export interface ShinyModuleProviderProps {
* useShinyMessageHandler will automatically have their IDs prefixed
* with the provided namespace.
*
* Note: This provider does NOT support nesting. If you need nested modules,
* pass the full namespace string (e.g., "outer-inner") directly.
* Note: Nesting providers is supported — an inner provider overrides the
* outer one (it does not concatenate namespaces). If you need a combined
* namespace, pass the full string (e.g., "outer-inner") directly.
*
* @param namespace The complete namespace string to apply to child hooks.
* @param children React children that will receive the namespace context.
Expand Down Expand Up @@ -48,8 +49,8 @@ export function useShinyModuleNamespace(): string | null {

/**
* Utility function to apply namespace to an ID.
* If namespace is provided, returns `${namespace}-${id}`.
* Otherwise returns the original id.
* If namespace is a non-empty string, returns `${namespace}-${id}`.
* If namespace is null, undefined, or empty string, returns the original id.
*/
export function applyNamespace(
id: string,
Expand Down
Loading