plane/web/hooks
João Lucas de Oliveira Lopes a1d6c40627
fix: show window closing alert only when page is not saved (#3577)
* fix: show window closing alert only when page is not saved

* chore: Refactor useReloadConfirmations hook

- Removed the `message` parameter, as it was not being used and not
  supported in modern browsers
- Changed the `isActive` flag to a temporary flag and added a TODO comment to remove it later.
- Implemented the `handleRouteChangeStart` function to handle route change events and prompt the user with a confirmation dialog before leaving the page.
- Updated the dependencies of the `handleBeforeUnload` and `handleRouteChangeStart` callbacks.
- Added event listeners for `beforeunload` and `routeChangeStart` events in the `useEffect` hook.
- Cleaned up the event listeners in the cleanup function of the `useEffect` hook.

fix: Fix reload confirmations in PageDetailsPage

- Removed the TODO comment regarding fixing reload confirmations with MobX, as it has been resolved.
- Passed the `pageStore?.isSubmitting === "submitting"` flag to the `useReloadConfirmations` hook instead of an undefined message.

This commit refactors the `useReloadConfirmations` hook to improve its functionality and fixes the usage in the `PageDetailsPage` component.

---------

Co-authored-by: Palanikannan1437 <73993394+Palanikannan1437@users.noreply.github.com>
2024-02-07 17:10:44 +05:30
..
store chore: posthog events improved (#3554) 2024-02-05 13:19:07 +05:30
use-comment-reaction.tsx refactor: MobX store structure (#3228) 2024-01-02 18:12:55 +05:30
use-current-time.tsx chore: update time in real-time in dashboard and profile sidebar (#3489) 2024-01-29 15:42:57 +05:30
use-debounce.tsx New Directory Setup (#2065) 2023-09-03 18:50:30 +05:30
use-draggable-portal.ts fix: Labels delete & reordering (#2729) 2023-12-07 19:59:35 +05:30
use-dropdown-key-down.tsx refactor: dropdown button components (#3508) 2024-01-31 15:36:55 +05:30
use-dynamic-dropdown.tsx chore: dynamic position dropdown (#2138) 2023-09-20 12:24:52 +05:30
use-integration-popup.tsx fix: environment config changes in the API are replicated in web and space app (#2699) 2023-11-07 17:17:10 +05:30
use-issue-notification-subscription.tsx refactor: MobX store structure (#3228) 2024-01-02 18:12:55 +05:30
use-keypress.tsx feat: quick add (#2240) 2023-09-22 15:31:54 +05:30
use-local-storage.tsx fix: Implementing mobx, refactoring service layer and rewriting components (#2441) 2023-10-15 23:50:12 +05:30
use-outside-click-detector.tsx New Directory Setup (#2065) 2023-09-03 18:50:30 +05:30
use-reload-confirmation.tsx fix: show window closing alert only when page is not saved (#3577) 2024-02-07 17:10:44 +05:30
use-sign-in-redirection.ts refactor: MobX store structure (#3228) 2024-01-02 18:12:55 +05:30
use-timer.tsx New Directory Setup (#2065) 2023-09-03 18:50:30 +05:30
use-toast.tsx New Directory Setup (#2065) 2023-09-03 18:50:30 +05:30
use-user-auth.tsx refactor: MobX store structure (#3228) 2024-01-02 18:12:55 +05:30
use-user-notifications.tsx fix: Add missing project and subscriber filters to the list of filter params (#3497) 2024-01-29 17:26:48 +05:30
use-user.tsx refactor: MobX store structure (#3228) 2024-01-02 18:12:55 +05:30
use-workspace-issue-properties.ts chore: applying query params to the global issues filters in the global views (#3464) 2024-01-25 14:27:35 +05:30