@mcurros2/microm 1.1.94-0 → 1.1.96-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/dist/index.js CHANGED
@@ -461,7 +461,10 @@ function $8b0c683387a5432f$export$f1f43a62560a15ec(props) {
461
461
  (0, $b4te3$react.useEffect)(()=>{
462
462
  const handleBeforeUnload = ()=>$8b0c683387a5432f$var$__awaiter(this, void 0, void 0, function*() {
463
463
  try {
464
- if (saveBeforeRemoteNavigation) yield saveAndGet();
464
+ if (saveBeforeRemoteNavigation && form.isDirty()) {
465
+ form.validate();
466
+ yield saveAndGet();
467
+ }
465
468
  } catch (ex) {
466
469
  console.error("SaveBeforeRemoteNavigation", ex);
467
470
  }
@@ -471,13 +474,18 @@ function $8b0c683387a5432f$export$f1f43a62560a15ec(props) {
471
474
  window.removeEventListener("beforeunload", handleBeforeUnload);
472
475
  };
473
476
  }, [
477
+ form,
478
+ saveAndGet,
474
479
  saveBeforeRemoteNavigation
475
480
  ]);
476
481
  const prevLocationRef = (0, $b4te3$react.useRef)(window.location.hash);
477
482
  (0, $b4te3$react.useEffect)(()=>{
478
483
  const handleLocalNavigation = ()=>$8b0c683387a5432f$var$__awaiter(this, void 0, void 0, function*() {
479
484
  try {
480
- if (saveBeforeLocalNavigation && prevLocationRef.current !== window.location.hash) yield saveAndGet();
485
+ if (saveBeforeLocalNavigation && form.isDirty() && prevLocationRef.current !== window.location.hash) {
486
+ form.validate();
487
+ yield saveAndGet();
488
+ }
481
489
  } catch (ex) {
482
490
  console.error("SaveBeforeLocalNavigation", ex);
483
491
  }
@@ -487,6 +495,8 @@ function $8b0c683387a5432f$export$f1f43a62560a15ec(props) {
487
495
  window.removeEventListener("hashchange", handleLocalNavigation);
488
496
  };
489
497
  }, [
498
+ form,
499
+ saveAndGet,
490
500
  saveBeforeLocalNavigation
491
501
  ]);
492
502
  const result = (0, $b4te3$react.useMemo)(()=>({