-
Notifications
You must be signed in to change notification settings - Fork 451
feat: add custom hook to handle window close and reload events #746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add custom hook to handle window close and reload events #746
Conversation
@afsar-hussai is attempting to deploy a commit to the dunsin's projects Team on Vercel. A member of the Team first needs to authorize it. |
Hi @afsar-hussai please provide a working screen recording for this and kindly attach it to the PR |
|
|
||
import { useEffect } from "react" | ||
|
||
export const useCloseAndReloadHandle=(condition=true)=>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you name the args betters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general Hooks are written with use, so here i created a hook thats why i use useCloseAndReloadHandle as hook name.
|
||
function App() { | ||
ReactGA.initialize(import.meta.env.VITE_GOOGLE_ANALYTICS); | ||
useCloseAndReloadHandle(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do you plan to check if the chat is active or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes please can you guide me to do this. lets colabrate and do this.
a few things to add here:
|
is this under active development? i can work on this if needed |
@t-trafer he still has 5 days to fix his PR, in the meantime you can check other issues and see what else you can work on |
yeah that works @Dun-sin thanks |
@t-trafer still want to work on this? |
hi @afsar-hussai the time assigned to this Issue is over, your PR is now closed. Thanks for trying to contribute, you're free to ask to work on other issues, if you can meet up with the time assigned. |
π Feature: Warn Users Before Closing/Reloading Tab
Fixes Issue
**My PR closes #452 **
π¨βπ» Changes proposed(What did you do ?)
useBeforeUnload
) that listens to thebeforeunload
event.App.jsx
to ensure it applies globally across the entire app.βοΈ Check List
Note to reviewers
true
, ensuring the dialog always appears unless explicitly disabled.π· Screenshots
N/A