-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix Navigation Link block constantly updating its inner block list settings #30274
Conversation
Size Change: +19 B (0%) Total Size: 1.42 MB
ℹ️ View Unchanged
|
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.
@talldan this helps quite a bit! 🤔 The previous selector behavior is curious, since I didn't spot any common mistakes with redux data triggering too many updates.
I also did a quick profile while dragging on this branch. It looks like ToolbarItems render while dragging, so that might be a good spot to do a similar optimization on the navigation-link RichText in edit.js
This is beyond my skill to code review or debug, but I wanted to note that I'm seeing a navigation block error, both in trunk but also in this branch: #30177 (comment)
|
Nice steps @jasmussen 💖 that's a lot easier to profile consistently. |
I'll follow up with further PRs looking into the other issues. |
Description
This takes us a step closer to fixing the root cause of #30177
The underlying cause is that
useNestedSettingsUpdate
performs a shallow equality check before updating a block list's settings.This combined with the way navigation link was passing through a new array for
allowedBlocks
on every render, causing the settings to update, resulted in a cascading render.This was compounded for some reason when using the
isDraggingBlocks
selector. Still not entirely sure why that would be, but I'll continue looking into that. It might be that updating the block list settings is causing the inner blocks to re-render, which is also causing the action that updates the dragged blocks to trigger 🤷♂️ .This first step tidies up the nav link block. It might also be worth changing the way
useNestedSettingsUpdate
checks for equality. Some of the props may need more than just shallow equality.How has this been tested?
git revert 19fa71b
)Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: