-
Notifications
You must be signed in to change notification settings - Fork 138
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 batching after page navigation #915
Conversation
🦋 Changeset detectedLatest commit: 92e118c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -7,23 +7,23 @@ | |||
* | |||
* adapted from https://stackoverflow.com/questions/3239834/window-onbeforeunload-not-working-on-the-ipad/52864508#52864508, | |||
*/ | |||
export const onPageLeave = (cb: (...args: unknown[]) => void) => { | |||
export const onPageChange = (cb: (...args: boolean[]) => void) => { |
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.
Nit:
This sig says that there are multiple bool args.
Type signature should just be (unloaded: boolean) => void
@@ -91,10 +91,10 @@ export default function batch( | |||
}, timeout) | |||
} | |||
|
|||
onPageLeave(() => { | |||
pageUnloaded = true | |||
onPageChange((unloaded: boolean) => { |
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.
Nit: No need to put "boolean" here; that should be part of the fn signature type
This PR addresses a bug where if a user navigated to another page and then back, batching no longer worked. This was due to the 'pageUnloaded' variable never being set back to false.
yarn changeset
. Read about changesets here).