kitchen-simulator 3.5.0 → 3.6.0
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/es/index.js +13 -3
- package/lib/index.js +13 -3
- package/package.json +1 -1
package/es/index.js
CHANGED
|
@@ -521,9 +521,19 @@ export function renderKitchenSimulator(container) {
|
|
|
521
521
|
destroyed = true;
|
|
522
522
|
api.clearQueue();
|
|
523
523
|
gltfTracker.uninstall();
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
524
|
+
|
|
525
|
+
// ✅ defer unmount to avoid "unmount while React is rendering"
|
|
526
|
+
var doUnmount = function doUnmount() {
|
|
527
|
+
try {
|
|
528
|
+
root.unmount();
|
|
529
|
+
} finally {
|
|
530
|
+
container[ROOT_KEY] = null;
|
|
531
|
+
container[API_KEY] = null;
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
// Prefer microtask when available, otherwise macrotask
|
|
536
|
+
if (typeof queueMicrotask === 'function') queueMicrotask(doUnmount);else setTimeout(doUnmount, 0);
|
|
527
537
|
}
|
|
528
538
|
};
|
|
529
539
|
|
package/lib/index.js
CHANGED
|
@@ -529,9 +529,19 @@ function renderKitchenSimulator(container) {
|
|
|
529
529
|
destroyed = true;
|
|
530
530
|
api.clearQueue();
|
|
531
531
|
gltfTracker.uninstall();
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
532
|
+
|
|
533
|
+
// ✅ defer unmount to avoid "unmount while React is rendering"
|
|
534
|
+
var doUnmount = function doUnmount() {
|
|
535
|
+
try {
|
|
536
|
+
root.unmount();
|
|
537
|
+
} finally {
|
|
538
|
+
container[ROOT_KEY] = null;
|
|
539
|
+
container[API_KEY] = null;
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
// Prefer microtask when available, otherwise macrotask
|
|
544
|
+
if (typeof queueMicrotask === 'function') queueMicrotask(doUnmount);else setTimeout(doUnmount, 0);
|
|
535
545
|
}
|
|
536
546
|
};
|
|
537
547
|
|