-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Add onbeforeunload and have it call onCancel #7335
Conversation
ui/app/components/app/provider-page-container/provider-page-container.component.js
Outdated
Show resolved
Hide resolved
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.
Small nitpick: can we move componentWillUnmount
below componentDidMount
? (We (c|s)hould have a lint rule maybe)
Incidentally, the e2e test failure may have been fixed in the PR I just merged today. I would suggest rebasing on latest develop. |
I'll wait for the build to pass before approving but this LGTM |
Darn, I guess it didn't fix it after all 😞 I was thinking that one of the calls to |
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.
Oh, one difference I just noticed between this and the other beforeunload
handlers is that the others record a separate metric event for this scenario, rather than reusing the same function as for the cancel button. That would probably be better to do in this case as well.
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.
On second thought, this behavior should be restricted to the notification UI. I don't think we want closing a fullscreen tab or the popup UI to constitute a rejection (especially not the popup UI, given that it closes when your mouse moves away)
Good point @Gudahtt @rickycodes See how I restricted this to the notification window in this PR: https://github.com/MetaMask/metamask-extension/pull/6340/files |
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.
Removing approval until above comment address, just to prevent accidental merger
ui/app/components/app/provider-page-container/provider-page-container.component.js
Outdated
Show resolved
Hide resolved
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.
LGTM
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.
LGTM, thanks @rickycodes!
This was first implemented in #7335, but the final version didn't work because the `_beforeUnload` handler was not bound early, so `this` was not defined when it was triggered.
This was first implemented in #7335, but the final version didn't work because the `_beforeUnload` handler was not bound early, so `this` was not defined when it was triggered.
re: #6489
this makes it so the same RPC error that fires when you cancel will also fire when you close the window.