[Block Library - Query Loop] Fix race condition for making Post blocks inside uneditable#33037
Merged
youknowriad merged 3 commits intotrunkfrom Jun 28, 2021
Merged
Conversation
…s inside uneditable
youknowriad
reviewed
Jun 28, 2021
|
Size Change: -82 B (0%) Total Size: 1.05 MB
ℹ️ View Unchanged
|
Contributor
|
How do you reproduce the issue, following the steps above, I can't 🤔 even in trunk? |
Contributor
Author
It's easier to reproduce when clicking the |
youknowriad
approved these changes
Jun 28, 2021
youknowriad
pushed a commit
that referenced
this pull request
Jun 28, 2021
…s inside uneditable (#33037)
youknowriad
pushed a commit
that referenced
this pull request
Jun 28, 2021
…s inside uneditable (#33037)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description and testing instructions from trac ticket:
Fixes trac ticket: https://core.trac.wordpress.org/ticket/53508. When back ported.
Note
It might be easier to reproduce when clicking the grid view of Query Loop patterns when inserting. Since it's a race condition between posts and queryId, you have to select a pattern that shows the Image Placeholder (in Featured Image) that looks like allowing the upload (which it does)
What was the problem
Query Loopneeds a unique id to handle multiple pagination properly and is usingqueryIdattribute. This attribute is set on insertion/creation of the block after the first rendering.This has caused some race conditions with the check we had for making Post blocks not editable inside this block, which used the existence of
queryId. This PR adds thequeryIdas a dependency to our memoized block contexts so as to always be provided down the chain.