-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
[Hydration Bugfix] Updates to dehydrated content when disableSchedulerTimeoutBasedOnReactExpirationTime
is enabled
#16614
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -288,6 +288,26 @@ describe('Scheduler', () => { | |
expect(Scheduler).toFlushWithoutYielding(); | ||
}); | ||
|
||
it('cancelling the currently running task', () => { | ||
const task = scheduleCallback(NormalPriority, () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are there any other priorities we need to test cancelling on other than normal? Should there be a test to confirm that discrete priority events do not get cancelled? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The priority shouldn't be relevant, but I'll add the same test at user-blocking priority as an extra precaution. |
||
Scheduler.unstable_yieldValue('Start'); | ||
for (let i = 0; !shouldYield(); i++) { | ||
if (i === 5) { | ||
// Canceling the current task will cause `shouldYield` to return | ||
// `true`. Otherwise this would infinite loop. | ||
Scheduler.unstable_yieldValue('Cancel'); | ||
cancelCallback(task); | ||
} | ||
} | ||
Scheduler.unstable_yieldValue('Finish'); | ||
// The continuation should be ignored, since the task was | ||
// already canceled. | ||
return () => Scheduler.unstable_yieldValue('Continuation'); | ||
}); | ||
|
||
expect(Scheduler).toFlushAndYield(['Start', 'Cancel', 'Finish']); | ||
}); | ||
|
||
it('top-level immediate callbacks fire in a subsequent task', () => { | ||
scheduleCallback(ImmediatePriority, () => | ||
Scheduler.unstable_yieldValue('A'), | ||
|
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.
Was this intentional?
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.
Probably not necessary, I just copy pasted from the top of the file for consistency:
react/packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js
Lines 23 to 36 in 83102b6