kitchen-simulator 3.5.1 → 3.7.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 CHANGED
@@ -272,7 +272,7 @@ export function renderKitchenSimulator(container) {
272
272
  var waitForGltf = (_props$waitForGltfIdl = props.waitForGltfIdleAfterEachEvent) !== null && _props$waitForGltfIdl !== void 0 ? _props$waitForGltfIdl : true;
273
273
  var defaultTimeout = (_props$gltfTimeoutMs = props.gltfTimeoutMs) !== null && _props$gltfTimeoutMs !== void 0 ? _props$gltfTimeoutMs : 30000;
274
274
  var defaultGrace = (_props$gltfGraceMs = props.gltfGraceMs) !== null && _props$gltfGraceMs !== void 0 ? _props$gltfGraceMs : 50;
275
- var syncGrace = (_props$syncGltfGraceM = props.syncGltfGraceMs) !== null && _props$syncGltfGraceM !== void 0 ? _props$syncGltfGraceM : 600; // SyncScene uses larger grace
275
+ var syncGrace = (_props$syncGltfGraceM = props.syncGltfGraceMs) !== null && _props$syncGltfGraceM !== void 0 ? _props$syncGltfGraceM : 250; // SyncScene uses larger grace
276
276
  var syncExtraFrames = (_props$syncExtraFrame = props.syncExtraFrames) !== null && _props$syncExtraFrame !== void 0 ? _props$syncExtraFrame : 2;
277
277
  var draining = false;
278
278
  function isSyncScene(ev) {
@@ -521,9 +521,19 @@ export function renderKitchenSimulator(container) {
521
521
  destroyed = true;
522
522
  api.clearQueue();
523
523
  gltfTracker.uninstall();
524
- root.unmount();
525
- container[ROOT_KEY] = null;
526
- container[API_KEY] = null;
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
@@ -280,7 +280,7 @@ function renderKitchenSimulator(container) {
280
280
  var waitForGltf = (_props$waitForGltfIdl = props.waitForGltfIdleAfterEachEvent) !== null && _props$waitForGltfIdl !== void 0 ? _props$waitForGltfIdl : true;
281
281
  var defaultTimeout = (_props$gltfTimeoutMs = props.gltfTimeoutMs) !== null && _props$gltfTimeoutMs !== void 0 ? _props$gltfTimeoutMs : 30000;
282
282
  var defaultGrace = (_props$gltfGraceMs = props.gltfGraceMs) !== null && _props$gltfGraceMs !== void 0 ? _props$gltfGraceMs : 50;
283
- var syncGrace = (_props$syncGltfGraceM = props.syncGltfGraceMs) !== null && _props$syncGltfGraceM !== void 0 ? _props$syncGltfGraceM : 600; // SyncScene uses larger grace
283
+ var syncGrace = (_props$syncGltfGraceM = props.syncGltfGraceMs) !== null && _props$syncGltfGraceM !== void 0 ? _props$syncGltfGraceM : 250; // SyncScene uses larger grace
284
284
  var syncExtraFrames = (_props$syncExtraFrame = props.syncExtraFrames) !== null && _props$syncExtraFrame !== void 0 ? _props$syncExtraFrame : 2;
285
285
  var draining = false;
286
286
  function isSyncScene(ev) {
@@ -529,9 +529,19 @@ function renderKitchenSimulator(container) {
529
529
  destroyed = true;
530
530
  api.clearQueue();
531
531
  gltfTracker.uninstall();
532
- root.unmount();
533
- container[ROOT_KEY] = null;
534
- container[API_KEY] = null;
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitchen-simulator",
3
- "version": "3.5.1",
3
+ "version": "3.7.0",
4
4
  "description": "It is a kitchen simulator (self-contained micro-frontend).",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",