Skip to content

onUnload function not working properly #130

Open
@AdityaKirad

Description

@AdityaKirad

the onUnload function triggers as soon as the new window opens up so the problem is that I have this state

const [popup, setPopUp] = useState(false);

and this button

<Button onClick={() => setPopUp(true)}>Login</Button>
{ popup && !session ? (
                <NewWindow url='/SignInPage' onUnload={() => setPopUp(false)} />
              ) : null }

so as I click on the button the state of popup become true and the new window pops up but since the onUnload function triggers before new window unload so the state of popup become false immediately and the popup closes but when I removed onUnload={() => setPopUp(false)} and clicked on the button the new window opens up and the it doesn't closes the onUnload function should triggered after the new window unload

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions