kitchen-simulator 5.10.10-react.18 → 5.10.12-react.18
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.
|
@@ -43,6 +43,10 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
43
43
|
var _this;
|
|
44
44
|
_classCallCheck(this, LiteKitchenConfigurator);
|
|
45
45
|
_this = _callSuper(this, LiteKitchenConfigurator, [props]);
|
|
46
|
+
_this._catalogInitRequested = false;
|
|
47
|
+
_this._lastHandledExternalEvent = null;
|
|
48
|
+
_this._handlingExternalEvent = false;
|
|
49
|
+
_this._scheduledExternalEventRaf = null;
|
|
46
50
|
_this.state = {
|
|
47
51
|
savePopupVisible: false,
|
|
48
52
|
quotePopupVisible: false,
|
|
@@ -292,30 +296,81 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
292
296
|
key: "componentDidMount",
|
|
293
297
|
value: function componentDidMount() {
|
|
294
298
|
var _extractedState$getIn;
|
|
295
|
-
window.forRedo = [];
|
|
296
299
|
var _this$props = this.props,
|
|
297
300
|
catalog = _this$props.catalog,
|
|
298
301
|
extractedState = _this$props.extractedState,
|
|
299
302
|
projectActions = _this$props.projectActions;
|
|
300
303
|
var catalogReady = extractedState === null || extractedState === void 0 || (_extractedState$getIn = extractedState.getIn) === null || _extractedState$getIn === void 0 ? void 0 : _extractedState$getIn.call(extractedState, ['catalog', 'ready']);
|
|
301
|
-
if (!catalogReady
|
|
304
|
+
if (!catalogReady && !this._catalogInitRequested) {
|
|
305
|
+
this._catalogInitRequested = true;
|
|
306
|
+
console.log('[LiteKitchenConfigurator] initCatalog (mount)');
|
|
307
|
+
projectActions.initCatalog(catalog);
|
|
308
|
+
}
|
|
302
309
|
}
|
|
303
310
|
}, {
|
|
304
311
|
key: "componentDidUpdate",
|
|
305
312
|
value: function componentDidUpdate(prevProps) {
|
|
306
|
-
var
|
|
313
|
+
var _this2 = this,
|
|
314
|
+
_extractedState$getIn2;
|
|
307
315
|
var _this$props2 = this.props,
|
|
308
316
|
externalEvent = _this$props2.externalEvent,
|
|
309
317
|
extractedState = _this$props2.extractedState,
|
|
310
318
|
projectActions = _this$props2.projectActions,
|
|
311
319
|
catalog = _this$props2.catalog;
|
|
312
320
|
|
|
313
|
-
//
|
|
314
|
-
if (prevProps.externalEvent !== externalEvent) {
|
|
315
|
-
|
|
321
|
+
// ---- (A) External event handling (snapshot + defer) ----
|
|
322
|
+
if (prevProps.externalEvent !== externalEvent && externalEvent) {
|
|
323
|
+
if (this._lastHandledExternalEvent === externalEvent) {
|
|
324
|
+
console.warn('[LiteKitchenConfigurator] externalEvent already handled (same ref), skipping');
|
|
325
|
+
} else if (this._handlingExternalEvent) {
|
|
326
|
+
console.warn('[LiteKitchenConfigurator] externalEvent handling already in progress, skipping');
|
|
327
|
+
} else {
|
|
328
|
+
this._lastHandledExternalEvent = externalEvent;
|
|
329
|
+
this._handlingExternalEvent = true;
|
|
330
|
+
|
|
331
|
+
// capture props snapshot corresponding to this event
|
|
332
|
+
var propsSnapshot = this.props;
|
|
333
|
+
var type = (externalEvent === null || externalEvent === void 0 ? void 0 : externalEvent.type) || 'unknown';
|
|
334
|
+
if (this._scheduledExternalEventRaf) {
|
|
335
|
+
clearTimeout(this._scheduledExternalEventRaf);
|
|
336
|
+
this._scheduledExternalEventRaf = null;
|
|
337
|
+
}
|
|
338
|
+
this._scheduledExternalEventRaf = setTimeout(function () {
|
|
339
|
+
_this2._scheduledExternalEventRaf = null;
|
|
340
|
+
console.time("[handleExternalEvent] ".concat(type));
|
|
341
|
+
try {
|
|
342
|
+
handleExternalEvent(propsSnapshot);
|
|
343
|
+
} catch (e) {
|
|
344
|
+
console.error('[LiteKitchenConfigurator] handleExternalEvent crashed', e);
|
|
345
|
+
} finally {
|
|
346
|
+
console.timeEnd("[handleExternalEvent] ".concat(type));
|
|
347
|
+
_this2._handlingExternalEvent = false;
|
|
348
|
+
}
|
|
349
|
+
}, 0);
|
|
350
|
+
}
|
|
316
351
|
}
|
|
352
|
+
|
|
353
|
+
// ---- (B) initCatalog: request once until ready ----
|
|
317
354
|
var catalogReady = extractedState === null || extractedState === void 0 || (_extractedState$getIn2 = extractedState.getIn) === null || _extractedState$getIn2 === void 0 ? void 0 : _extractedState$getIn2.call(extractedState, ['catalog', 'ready']);
|
|
318
|
-
if (
|
|
355
|
+
if (catalogReady) {
|
|
356
|
+
if (this._catalogInitRequested) console.log('[LiteKitchenConfigurator] catalog ready');
|
|
357
|
+
this._catalogInitRequested = false;
|
|
358
|
+
} else {
|
|
359
|
+
if (!this._catalogInitRequested) {
|
|
360
|
+
this._catalogInitRequested = true;
|
|
361
|
+
console.log('[LiteKitchenConfigurator] initCatalog (update)');
|
|
362
|
+
projectActions.initCatalog(catalog);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}, {
|
|
367
|
+
key: "componentWillUnmount",
|
|
368
|
+
value: function componentWillUnmount() {
|
|
369
|
+
// cleanup scheduled external event
|
|
370
|
+
if (this._scheduledExternalEventRaf) {
|
|
371
|
+
cancelAnimationFrame(this._scheduledExternalEventRaf);
|
|
372
|
+
this._scheduledExternalEventRaf = null;
|
|
373
|
+
}
|
|
319
374
|
}
|
|
320
375
|
}, {
|
|
321
376
|
key: "isProjectEmpty",
|
|
@@ -365,7 +420,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
365
420
|
}, {
|
|
366
421
|
key: "render",
|
|
367
422
|
value: function render() {
|
|
368
|
-
var
|
|
423
|
+
var _this3 = this;
|
|
369
424
|
var _this$props3 = this.props,
|
|
370
425
|
width = _this$props3.width,
|
|
371
426
|
height = _this$props3.height,
|
|
@@ -381,7 +436,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
381
436
|
var contentH = height;
|
|
382
437
|
var extracted = this.getExtractedStateWithViewer2DInit(extractedState, width, height);
|
|
383
438
|
var ctxValue = _objectSpread(_objectSpread({}, objectsMap(actions, function (actionNamespace) {
|
|
384
|
-
return
|
|
439
|
+
return _this3.props[actionNamespace];
|
|
385
440
|
})), {}, {
|
|
386
441
|
translator: this.props.translator,
|
|
387
442
|
catalog: this.props.catalog
|