-
Notifications
You must be signed in to change notification settings - Fork 48.7k
[Flare] Update interactiveUpdates flushing heuristics #15687
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
Changes from 1 commit
41d39be
0263165
b821081
5096048
3c2f42d
592a89b
773ce49
6dcb4fb
9312d3d
228efd7
f6c57af
eef7b78
8050d88
52ffb56
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 |
---|---|---|
|
@@ -2308,14 +2308,12 @@ describe('Event responder: Press', () => { | |
const ref = React.createRef(); | ||
let renderCounts = 0; | ||
|
||
function dispatchEvent(name) { | ||
function dispatchEvent(name, timeStamp) { | ||
const event = createEvent(name); | ||
Object.defineProperty(event, 'timeStamp', { | ||
value: 100, | ||
value: timeStamp, | ||
}); | ||
window.event = event; | ||
ref.current.dispatchEvent(event); | ||
window.event = null; | ||
} | ||
|
||
function MyComponent() { | ||
|
@@ -2347,13 +2345,32 @@ describe('Event responder: Press', () => { | |
root.render(<MyComponent />); | ||
Scheduler.flushAll(); | ||
|
||
dispatchEvent('pointerdown'); | ||
dispatchEvent('pointerup'); | ||
dispatchEvent('click'); | ||
dispatchEvent('pointerdown', 100); | ||
dispatchEvent('pointerup', 100); | ||
dispatchEvent('click', 100); | ||
|
||
expect(renderCounts).toBe(2); | ||
if (__DEV__) { | ||
expect(renderCounts).toBe(2); | ||
} else { | ||
expect(renderCounts).toBe(1); | ||
} | ||
Scheduler.flushAll(); | ||
expect(renderCounts).toBe(4); | ||
if (__DEV__) { | ||
expect(renderCounts).toBe(4); | ||
} else { | ||
expect(renderCounts).toBe(2); | ||
} | ||
|
||
dispatchEvent('pointerdown', 100); | ||
dispatchEvent('pointerup', 100); | ||
// Ensure the timeStamp logic works | ||
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. Is the Press event component the best place to test this logic? 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. It’s fine for now. All responders should have some variant of this too. 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. It's that the changes are being made to the core but the tests are here. And those tests have 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. We can follow up after and make tests in core too. I don't want to block this any longer given I'm on PTO in a few days. Maybe we can add this to our TODO list otherwise. |
||
dispatchEvent('click', 101); | ||
|
||
if (__DEV__) { | ||
expect(renderCounts).toBe(6); | ||
} else { | ||
expect(renderCounts).toBe(3); | ||
} | ||
|
||
document.body.removeChild(newContainer); | ||
}); | ||
trueadm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
Uh oh!
There was an error while loading. Please reload this page.