@mcurros2/microm 1.1.95-0 → 1.1.97-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
@@ -430,7 +430,11 @@ function $8b0c683387a5432f$export$f1f43a62560a15ec(props) {
430
430
  if (getDataOnInit) {
431
431
  function getData() {
432
432
  return $8b0c683387a5432f$var$__awaiter(this, void 0, void 0, function*() {
433
- yield performGetData();
433
+ const result = yield performGetData();
434
+ if (result) {
435
+ form.resetDirty();
436
+ form.resetTouched();
437
+ }
434
438
  });
435
439
  }
436
440
  getData();
@@ -461,7 +465,7 @@ function $8b0c683387a5432f$export$f1f43a62560a15ec(props) {
461
465
  (0, $b4te3$react.useEffect)(()=>{
462
466
  const handleBeforeUnload = ()=>$8b0c683387a5432f$var$__awaiter(this, void 0, void 0, function*() {
463
467
  try {
464
- if (saveBeforeRemoteNavigation) {
468
+ if (saveBeforeRemoteNavigation && form.isDirty()) {
465
469
  form.validate();
466
470
  yield saveAndGet();
467
471
  }
@@ -482,7 +486,7 @@ function $8b0c683387a5432f$export$f1f43a62560a15ec(props) {
482
486
  (0, $b4te3$react.useEffect)(()=>{
483
487
  const handleLocalNavigation = ()=>$8b0c683387a5432f$var$__awaiter(this, void 0, void 0, function*() {
484
488
  try {
485
- if (saveBeforeLocalNavigation && prevLocationRef.current !== window.location.hash) {
489
+ if (saveBeforeLocalNavigation && form.isDirty() && prevLocationRef.current !== window.location.hash) {
486
490
  form.validate();
487
491
  yield saveAndGet();
488
492
  }