-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Prvent early _debounceScrollEndedCallback(&cellRangeRenderer), when process slow Grid's #1141
Conversation
BUMP |
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.
Do you mind explaining how Promise.resolve().then
waits for the end of processing of the current event handler?
Promis.resolve planned as microtask Simple example, and his timeline window.onclick = function() {
sync('start');
// 1 - plan promise, and timer
Promise.resolve().then(function() {
// 2 - promise resolved at microtask(at end of click)
sync('promise');
});
setTimeout(function() {
// 3 - timer triggered after click event(his handler, and microtask)
sync('timeout');
});
sync('end');
}
function sync(msg) {
var start = Date.now();
while(Date.now() - start < 1000);
console.log(`sync ${msg}`);
} |
@Gvozd Thanks for the link! I'll give that a look |
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.
After minor comment this looks good!
TIL about the browser event loop. Thanks @Gvozd :)
source/Grid/Grid.jest.js
Outdated
cellRangeRendererCalls.push(props); | ||
return defaultCellRangeRenderer(props); | ||
} | ||
const props = { |
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.
I believe the only prop you need to override from the default is scrollingResetTimeInterval
getMarkup
https://github.com/bvaughn/react-virtualized/blob/master/source/Grid/Grid.jest.js#L44 provides the required default props which shouldn't additionally specified unless necessary for the test.
…rocess slow Grid's
Fix test by CodeReview |
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.
Nice! Thanks
* bvaughn/master: (54 commits) Update version and changelog for 9.21.0 release (bvaughn#1252) chore: update lockfile Update ci badge (bvaughn#1227) Allow users to override default table row styles (bvaughn#1175) Add onColumnClick to Table (bvaughn#1207) remove unused variable in Masonry.example.js (bvaughn#1218) Fix Table aria attributes (bvaughn#1208) Fix typo in CellMeasurer.DynamicHeightTableColumn.example.js (bvaughn#1190) Update usingAutoSizer.md (bvaughn#1186) Add an extra check for an e.target.className.indexOf function (bvaughn#1210) Fix broken Slack badge image (bvaughn#1205) docs(CellMeasurer): fix `import` statement (bvaughn#1187) Added new friend (bvaughn#1197) Fix createMultiSort bug (bvaughn#1051) adding new usecase example and fix some typos (bvaughn#1168) Updating version to 9.20.1 Update changelog for the 9.20.1 release (bvaughn#1167) Prevent early debounceScrollEndedCallback when there is a slow render (bvaughn#1141) removing sideEffects (bvaughn#1163) fix for bvaughn#998 with test cases (bvaughn#1154) ...
const start = Date.now(); | ||
let start; | ||
// wait for end of processing current event handler, because event handler may be long | ||
Promise.resolve().then(() => { |
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.
FYI this adds core-js polyfill to the output
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.
I have no idea what to do with it.
Looks like we'll have to leave it at that.
When I render Grid with big count of visible cells, and/or slow renderCell, scrolling so slow, beacause _debounceScrollEndedCallback force additional renders
At now _debounceScrollEndedCallback really called at end of scrolling
npm test
) all passNot relevant for this.
Not relevant for this.
npm run prettier
).npm run prettier
failed byNo matching files.
, but eslint succeednpm run typecheck
).