Repository navigation
Blocks: simplify/optimise isUnmodifiedBlock - #56919
Conversation
|
Size Change: -32 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 4e48a90. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7179834066
|
cf61631 to
a1a7015
Compare
|
Initial testing seems good at the Gutenberg previewer. |
There was a problem hiding this comment.
we're checking the attributes on the block type here, but would it be important to compare also the attributes on this particular block instance that may not be on the block type?
for instance, if I setAttribute('formerlyNotPresentAttribute', true) then I would imagine I have a modified block, but the block type won't have formerlyNotPresentAttribute so it won't show different here
There was a problem hiding this comment.
We didn't before. And I guess if it's not officially declared, why check?
There was a problem hiding this comment.
I missed that in the before code. makes me wonder anyway if it's been a latent bug. no need to make it part of this change.
a1a7015 to
4e48a90
Compare
youknowriad
left a comment
There was a problem hiding this comment.
The logic of the change is good for me. It makes me wonder why we're calling this function so often?
|
Yes, the only suspects are block popover and the inserter/appender. But block popover doesn't show when typing, though we might be calling those selectors. We might also be calling appender selectors. Might have a look at some point. |
What?
This is one of the functions I see pop up a lot in the performance graph for the
inputevent, due to the rich text value to store PR (#43204). Because we're now comparing.valueOf(), these attributes are now serialised to check strict equality.This PR changes to function to look at the defaults in the attribute definition. If the attributes don't match the defaults, or are not empty, it means the block was modified.
Why?
This function runs on typing so it's important to change. It's also simpler.
How?
Described above
Testing Instructions
No tests should fail.
Testing Instructions for Keyboard
Screenshots or screencast