-
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
Inserter: Fix Block visibility manager #65700
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
deb6a90
Inserter: Fix Block visibility manager
youknowriad c15e396
Handle child blocks properly
youknowriad 2efecbd
Reintroduce core/post-content exception
youknowriad 5ea69f4
Restore patterns e2e test
youknowriad 5fd6fb9
Fix typo
youknowriad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
At this point, how do we know
blockType.parent
is an array? Can't it be a string, for example, that also has alength
property?For context, I'm looking at an issue in the support forum that I believe to be related to this check: the report is recent, the users report issues when inserting blocks, and there's no other place in the codebase that uses
parent.some
.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.
Looking at the block registration, it seems
parent
should be null or an array, but we don't enforce that.Even the recently added logic to block registration doesn't check that parent is an array. This:
would still be fine for blocks that register
parent
as a string.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.
One thing we can do to fix this is to make the if check above explicit for what we want to do: verify that it is an array and that it has elements.
The more general question is: how
parent
can become an array? Are block authors mis-registering this property? Can we now enforce it being an array?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.
PR at #66234
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.
Regarding this conditional statement, I suggested a change in this comment. However, I noticed that, unlike my comment, the order of each conditional was reversed when it was merged, which is certainly not what was intended.
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.
cc @gziolo for thoughts about enforcing the
blockType.parent
being an array at registration. Would that be feasible?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.
We are discussing it in this thread: #66234 (comment). The short answer is if we know that block types were registered with the
parent
set to a string, the best way would be to respect that and provide a fallback handling.