-
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
[Block Library - Site Title, Site Tagline]: Add delay to content changes #37234
Conversation
Size Change: +1.22 kB (0%) Total Size: 1.11 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.
The problem with the debounce approach is that the changes are not sent to the data store right away, meaning things like "dirty checks"... can be delayed. Can we instead use a similar technique to RichText here? (if we're editing the same attribute over time, reuse the last "undo" state until the "mark persistent" is called)
To be honest I don't remember the code exactly but the principle should be the same here.
// Wait a bit as the Site Title's onChange is debounced. | ||
await page.waitForSelector( | ||
'.editor-post-publish-button__button.has-changes-dot' | ||
); |
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.
In other words, this change shouldn't be necessary for the test to pass.
The thing is that there is no special technique in RichText. This is handled in If I'm not mistaken of course, to handle this in a similar way, we need to implement something either too specific (like checking So if my above assumption about the alternative approach is correct, is it worth it to implement this in core store? |
I guess my question here is why is this handled on the block-editor store and not directly on the core store? |
Answering myself: probably because the attributes are internal to the "block-editor" store and not something that is accessed outside it. Is it possible to make this behavior opt-in or opt-out somehow in the core-data store as well? How can we make sure that this is not just an adhoc fix for the site title but could work for any property (site title, post title, site tagline, excerpt...) |
Resolves: #37171
Currently undoing a site tagline or site title block change, reverts the text one character at a time, instead of in larger "chunks" like in the paragraph block.
This is happening because we have a specific handling for quick changes in the same block attribute here.
For now this PR just adds a little delay before applying these two blocks' changes.
Should we handle this in a similar way for
EDIT_ENTITY_RECORD
action? IMO it might not worth it a new API forentities
to handle specific fields, as I feel like there will not be many other cases besides these two sitesettings
. What do you think?