A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: anywidget re-render in wasm (#4175)
Myles Scolnickfd7a217961e0
diff --git a/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx b/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsxindex a1b858f71a..bdf155f17b 100644--- a/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx+++ b/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx@@ -128,12 +128,16 @@ const AnyWidgetSlot = (props: Props) => {return <ErrorBanner error={error} />;}+ // Find the closest parent element with an attribute of `random-id`+ const randomId = props.host.closest("[random-id]")?.getAttribute("random-id");+ const key = randomId ?? jsUrl;+return (<LoadedSlot- // Use the jsUrl as a key to force a re-render when the jsUrl changes+ // Use the a key to force a re-render when the randomId (or jsUrl) changes// Plugins may be stateful and we cannot make assumptions that we won't be// so it is safer to just re-render.- key={jsUrl}+ key={key}{...props}widget={module.default}value={valueWithBuffer}