Skip to content

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.

register UIElement on change if it is missing from the UIElementRegistry (#5474)

David Buckleycb6231d71a5f
diff --git a/frontend/src/core/dom/ui-element.ts b/frontend/src/core/dom/ui-element.ts
index bb2b432ac6..7eb5900fab 100644
--- a/frontend/src/core/dom/ui-element.ts
+++ b/frontend/src/core/dom/ui-element.ts
@@ -100,6 +100,14 @@ export function initializeUIElement() {
// broadcast? that would still let other elements cancel the event
// while also reducing the number of event listeners on the document
if (objectId !== null && e.detail.element === this.firstElementChild) {
+ // A UIElement may be missing from the registry if it was returned from a function that caches return values.
+ if (!UI_ELEMENT_REGISTRY.has(objectId)) {
+ UI_ELEMENT_REGISTRY.registerInstance(
+ objectId,
+ child as HTMLElement,
+ );
+ }
+
UI_ELEMENT_REGISTRY.broadcastValueUpdate(
child as HTMLElement,
objectId,