@homebound/beam 4.9.1 → 4.9.2
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.cjs +10 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -29407,6 +29407,7 @@ function useUnsavedChangesGuard(options) {
|
|
|
29407
29407
|
isDirtyRef.current = isDirty;
|
|
29408
29408
|
const allowNavigationRef = (0, import_react167.useRef)(allowNavigation);
|
|
29409
29409
|
allowNavigationRef.current = allowNavigation;
|
|
29410
|
+
const allowCancelNavigationRef = (0, import_react167.useRef)(false);
|
|
29410
29411
|
(0, import_react167.useEffect)(() => {
|
|
29411
29412
|
const onBeforeUnload = (e) => {
|
|
29412
29413
|
if (isDirtyRef.current?.()) {
|
|
@@ -29417,8 +29418,16 @@ function useUnsavedChangesGuard(options) {
|
|
|
29417
29418
|
return () => window.removeEventListener("beforeunload", onBeforeUnload);
|
|
29418
29419
|
}, []);
|
|
29419
29420
|
const blocker = (0, import_react_router_dom9.useBlocker)((args) => {
|
|
29421
|
+
if (allowCancelNavigationRef.current) {
|
|
29422
|
+
return false;
|
|
29423
|
+
}
|
|
29420
29424
|
return !!isDirtyRef.current?.() && !allowNavigationRef.current?.(args);
|
|
29421
29425
|
});
|
|
29426
|
+
const confirmCancel = (e) => {
|
|
29427
|
+
allowCancelNavigationRef.current = true;
|
|
29428
|
+
onCancel(e);
|
|
29429
|
+
allowCancelNavigationRef.current = false;
|
|
29430
|
+
};
|
|
29422
29431
|
const onCancelClick = (e) => {
|
|
29423
29432
|
if (!isDirty?.()) {
|
|
29424
29433
|
onCancel(e);
|
|
@@ -29426,7 +29435,7 @@ function useUnsavedChangesGuard(options) {
|
|
|
29426
29435
|
}
|
|
29427
29436
|
openModal({
|
|
29428
29437
|
allowClosing: false,
|
|
29429
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(ConfirmCloseModal, { onClose: () =>
|
|
29438
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(ConfirmCloseModal, { onClose: () => confirmCancel(e) })
|
|
29430
29439
|
});
|
|
29431
29440
|
};
|
|
29432
29441
|
const navigationBlocker = blocker.state === "blocked" ? { proceed: () => blocker.proceed?.(), cancelNavigation: () => blocker.reset?.() } : void 0;
|