-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
fix: confirmation when navigating from a form #3548
base: master
Are you sure you want to change the base?
Conversation
4 failed and 2 flaky tests on run #5600 ↗︎
Details:
src/integration/howto/write.spec.ts • 1 failed test • ci-chrome
src/integration/research/write.spec.ts • 3 failed tests • ci-chromesettings.spec.ts • 1 flaky test • ci-chrome
howto/write.spec.ts • 1 flaky test • ci-chrome
Review all test suite changes for PR #3548 ↗︎ |
@mariojsnunes I'll rerun the tests but this one looks related to your change? |
Visit the preview URL for this PR (updated for commit f10f39a): https://onearmy-next--pr3548-fix-prompt-hmxhrjz2.web.app (expires Wed, 03 Jul 2024 04:38:34 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 6d65e4f8fee2f6ab2da0c1c3b85b8797d66afa59 |
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.
hey @mariojsnunes, the updates to the usePrompt
hook look good.
could you give more context into the changes to src/pages/index.tsx
? looks like we're pulling in some new components from react-router-dom
, which is fine, but want to understand the motivation for the changes, as this impacts our entire routing infrastructure!
also, i noticed one weird behavior while testing - when you refresh from the how-to/create
page, you get a 404 page not found
// You can abstract `useBlocker` to use the browser's `window.confirm` dialog to | ||
// determine whether or not the user should navigate within the current origin. | ||
// `useBlocker` can also be used in conjunction with `useBeforeUnload` to | ||
// prevent navigation away from the current origin. | ||
// | ||
// IMPORTANT: There are edge cases with this behavior in which React Router | ||
// cannot reliably access the correct location in the history stack. In such | ||
// cases the user may attempt to stay on the page but the app navigates anyway, | ||
// or the app may stay on the correct page but the browser's history stack gets | ||
// out of whack. You should test your own implementation thoroughly to make sure | ||
// the tradeoffs are right for your users. |
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.
is this copied from documentation? if so, might be useful to also link the source
PR Checklist
PR Type
Description
Updated
usePrompt
to useuseBlocker
which should be more reliable.I remember I had to do this change a few months ago on another project due to a chrome update.
Hopefully this will improve flaky tests.
Git Issues
Closes #