-
Notifications
You must be signed in to change notification settings - Fork 4.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
List View: explore opening to focused block #35967
Conversation
Size Change: +4.1 kB (0%) Total Size: 1.08 MB
ℹ️ View Unchanged
|
Baseline before any changes https://github.com/WordPress/gutenberg/runs/4012470808
|
Thanks so much for setting this up and reviewing #35817 @gwwar Performance check after commit changes: #35967 (commits) https://github.com/WordPress/gutenberg/runs/4014766222
I think there's a slight drop in performance if I'm reading things right? Before
After
|
So querying for selectedId in the parent affects block focus time. You can test this locally with a post that has ~900 blocks. Trying to focus from one paragraph to another will lag by about a second, as we see here: More detailed explanation of why is in #35706. But the TL;DR is that by default if a parent updates in React all children re-render regardless of if props change. |
My other List View performance PR landed in #35230 ✨ I'm going to rebase with trunk to see the perf effects. Ideally changes here shouldn't slow down focus too much after the rebase. |
…t only when a block is selected outside the block list. Using an `useEffect` to loop through parent nodes, and expand them when necessary.
203379c
to
b2947ee
Compare
Ouch. Okay I was definitely focussing on the wrong stat 😆 Thanks for the explanation and for doing the heavy lifting on performance checks. |
Excellent, it looks like with windowing, we shouldn't see the terrible focus slowdown. I'd recommend manually testing to verify, but I think we can query for selectedId in the parent component again.
|
setExpandedState( { | ||
type: 'expand', | ||
clientId, | ||
} ); |
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.
Two recommendations here:
- Let's make a new action so we can dispatch a single one instead of many
- It might be worth exploring if we need to keep track of focus or not. (Is there any other state we can query?) I'd timebox this.
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.
Let's make a new action so we can dispatch a single one instead of many
Good idea. I'll make a start next week. Thanks again, and great work.
After pushing the latest changes from #35817 on top of #35230
A big improvement on #35967 (comment) Way to go @gwwar |
WIP alternative #35817
Spinning up a branch with some perf tests enabled, so we can see how different approaches work out.
After we get a baseline run, @ramonjd you're welcome to push to this branch.