@ensembleapp/client-sdk 0.0.44 → 0.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/widget/widget.global.js +34 -34
- package/dist/widget/widget.global.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26609,6 +26609,9 @@ function renderError(container, message) {
|
|
|
26609
26609
|
errorDiv.textContent = message;
|
|
26610
26610
|
container.appendChild(errorDiv);
|
|
26611
26611
|
}
|
|
26612
|
+
function defer(callback) {
|
|
26613
|
+
setTimeout(callback, 0);
|
|
26614
|
+
}
|
|
26612
26615
|
function WidgetRenderer({ widget, payload, enriched, messageContext, invokeTool }) {
|
|
26613
26616
|
const containerRef = useRef4(null);
|
|
26614
26617
|
const rootRef = useRef4(null);
|
|
@@ -26623,11 +26626,14 @@ function WidgetRenderer({ widget, payload, enriched, messageContext, invokeTool
|
|
|
26623
26626
|
useEffect5(() => {
|
|
26624
26627
|
return () => {
|
|
26625
26628
|
if (rootRef.current) {
|
|
26626
|
-
rootRef.current
|
|
26629
|
+
const root2 = rootRef.current;
|
|
26627
26630
|
rootRef.current = null;
|
|
26631
|
+
defer(() => root2.unmount());
|
|
26628
26632
|
} else if (isRenderedRef.current && containerRef.current && customerReactDOMRef.current) {
|
|
26629
26633
|
if (customerReactDOMRef.current.unmountComponentAtNode) {
|
|
26630
|
-
|
|
26634
|
+
const container = containerRef.current;
|
|
26635
|
+
const reactDOM = customerReactDOMRef.current;
|
|
26636
|
+
defer(() => reactDOM.unmountComponentAtNode?.(container));
|
|
26631
26637
|
} else {
|
|
26632
26638
|
console.warn(
|
|
26633
26639
|
`Widget unmounting but unmountComponentAtNode is missing. This may cause a memory leak.`
|