-
Notifications
You must be signed in to change notification settings - Fork 47.3k
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
Internal act
: Call scope function after an async gap
#26347
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ describe('Store component filters', () => { | |
let internalAct; | ||
|
||
const act = async (callback: Function) => { | ||
internalAct(callback); | ||
await internalAct(callback); | ||
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. Missed this in 702fc98. The warning was firing but it wasn't causing the test to fail. Changing it to a hard error surfaced it. 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. In my defense, that particular diff in #26338 was collapsed in GitHub so how was I supposed to see the snapshot changes? 😛 The snapshot changes made it easy to spot after the fact. 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. Yeah I must have accidentally updated the snapshots while it was in watch mode without realizing it, and then didn't see it in the collapsed view |
||
jest.runAllTimers(); // Flush Bridge operations | ||
}; | ||
|
||
|
@@ -373,7 +373,6 @@ describe('Store component filters', () => { | |
legacyRender(<Wrapper shouldSuspend={false} />, container), | ||
); | ||
expect(store).toMatchInlineSnapshot(` | ||
✕ 1, ⚠ 0 | ||
[root] | ||
▾ <Wrapper> | ||
<Component> | ||
|
@@ -383,7 +382,6 @@ describe('Store component filters', () => { | |
legacyRender(<Wrapper shouldSuspend={true} />, container), | ||
); | ||
expect(store).toMatchInlineSnapshot(` | ||
✕ 2, ⚠ 0 | ||
[root] | ||
▾ <Wrapper> | ||
▾ <Loading> | ||
|
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.
Might be overly pedantic but technically the timer queue isn't empty at this point.
jest.runOnlyPendingTimers()
does not run timers that were scheduled from pending timers. Don't know if that's relevant but I thought it was worth pointing out.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.
yeah the comment could be more accurate. The only reason we call it is to commit any pending Suspense fallbacks that were triggered by whatever React work was just performed.