@onehat/ui 0.3.140 → 0.3.142
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/package.json
CHANGED
|
@@ -412,20 +412,20 @@ export default function withSecondaryEditor(WrappedComponent, isTree = false) {
|
|
|
412
412
|
};
|
|
413
413
|
|
|
414
414
|
useEffect(() => {
|
|
415
|
-
// When
|
|
415
|
+
// When secondarySelection changes, set the mode appropriately
|
|
416
416
|
let mode;
|
|
417
417
|
if (secondaryIsIgnoreNextSelectionChange) {
|
|
418
|
-
// on
|
|
418
|
+
// on secondarySelection change from onAdd/onDuplicate/etc, calculate whether to put Editor in "add" or "edit" mode
|
|
419
419
|
mode = calculateEditorMode();
|
|
420
420
|
} else {
|
|
421
|
-
// Most of the time, if
|
|
421
|
+
// Most of the time, if secondarySelection changed, put the Editor in "view" mode
|
|
422
422
|
mode = EDITOR_MODE__VIEW;
|
|
423
423
|
}
|
|
424
|
-
|
|
424
|
+
secondarySetEditorMode(mode);
|
|
425
425
|
|
|
426
426
|
setSecondaryIsIgnoreNextSelectionChange(false);
|
|
427
|
-
setLastSelection(
|
|
428
|
-
}, [
|
|
427
|
+
setLastSelection(secondarySelection);
|
|
428
|
+
}, [secondarySelection]);
|
|
429
429
|
|
|
430
430
|
if (self) {
|
|
431
431
|
self.secondaryAdd = secondaryOnAdd;
|
|
@@ -438,13 +438,13 @@ export default function withSecondaryEditor(WrappedComponent, isTree = false) {
|
|
|
438
438
|
secondaryNewEntityDisplayValueRef.current = secondaryNewEntityDisplayValue;
|
|
439
439
|
|
|
440
440
|
if (secondaryLastSelection !== secondarySelection) {
|
|
441
|
-
// NOTE: If I don't calculate this on the fly for
|
|
441
|
+
// NOTE: If I don't calculate this on the fly for secondarySelection changes,
|
|
442
442
|
// we see a flash of the previous state, since useEffect hasn't yet run.
|
|
443
443
|
// (basically redo what's in the useEffect, above)
|
|
444
444
|
if (secondaryIsIgnoreNextSelectionChange) {
|
|
445
|
-
|
|
445
|
+
secondaryEditorMode = calculateEditorMode();
|
|
446
446
|
} else {
|
|
447
|
-
|
|
447
|
+
secondaryEditorMode = EDITOR_MODE__VIEW;
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
|