@onehat/ui 0.3.205 → 0.3.207

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onehat/ui",
3
- "version": "0.3.205",
3
+ "version": "0.3.207",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -125,6 +125,9 @@ function Form(props) {
125
125
  let skipAll = false;
126
126
  if (record?.isDestroyed) {
127
127
  skipAll = true; // if record is destroyed, skip render, but allow hooks to still be called
128
+ if (self?.parent?.parent?.setIsEditorShown) {
129
+ self.parent.parent.setIsEditorShown(false); // close the editor
130
+ }
128
131
  }
129
132
  const
130
133
  isMultiple = _.isArray(record),
@@ -439,6 +439,21 @@ export default function withEditor(WrappedComponent, isTree = false) {
439
439
  }
440
440
  };
441
441
 
442
+ useEffect(() => {
443
+ if (!Repository) {
444
+ return () => {};
445
+ }
446
+
447
+ function handleError(msg) {
448
+ alert(msg);
449
+ }
450
+
451
+ Repository.on('error', handleError);
452
+ return () => {
453
+ Repository.off('error', handleError);
454
+ };
455
+ }, []);
456
+
442
457
  useEffect(() => {
443
458
  // When selection changes, set the mode appropriately
444
459
  let mode;
@@ -462,6 +477,7 @@ export default function withEditor(WrappedComponent, isTree = false) {
462
477
  self.moveChildren = doMoveChildren;
463
478
  self.deleteChildren = doDeleteChildren;
464
479
  self.duplicate = doDuplicate;
480
+ self.setIsEditorShown = setIsEditorShown;
465
481
  }
466
482
  newEntityDisplayValueRef.current = newEntityDisplayValue;
467
483