-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Patterns: nested pattern block with overrides will not load #58291
Comments
@talldan, @kevin940726 I have taken a look at what would be needed to support nested patterns with overrides, and because the nested pattern does not get a A nested pattern's inner blocks are not resolved in the parent patterns This adds an extra level of complexity that would require significant work and testing, and I don't see supporting nested patterns with overrides as critical for the first release in 6.5 so I suggest we go with the simple approach of disabling this for now - but happy to discuss further if you think we need to support this initially. |
If I understand this correctly, I think this only affects when the user tries to edit nested patterns? Could we maybe instead disallow editing the patterns when they are nested in another pattern? |
Hmm, interesting - it sort of negates the value of the pattern overrides if the pattern can't be edited once inserted in an instance in the editor, but will have a play around with this and see if it makes sense if we just change the wording of this to "You cannot edit a pattern with overrides when it is nested inside another pattern." |
@kevin940726 I have updated the text of the editor message to |
Oh I mean a little bit differently I think. Let's say we have two overridable patterns 1 and 2. Pattern 1 has pattern 2 inside with overrides, and that can be edited in the pattern editor. <!-- Pattern 1 -->
<!-- wp:block {"ref":2,"overrides":{...}} /--> The post has pattern 1 with some other overrides. <!-- Post -->
<!-- wp:block {"ref":1,"overrides":{...}} /--> The post will render both pattern 1 and pattern 2, but could we disallow editing pattern 2 in this case? The other parts of pattern 1 can still be edited. WDYT? Or am I maybe misunderstanding the problem? Now that I think about it, maybe bubbling the overrides isn't too difficult after all? Maybe all we need is to give the nested pattern a block id just like other synced blocks? That's probably for a future enhancement though 😅. |
Bubbling is an interesting idea. Using @kevin940726's example above of Pattern 1 & 2, I think when you insert pattern 2 inside pattern 1, the editing experience of that inner pattern becomes a question mark. Are you allowed to set overrides at that point? And then when you insert pattern 1 into a post, can you override the overrides you set for pattern 2? Being able to compose patterns and overrides in that way sounds pretty powerful, but also very complicated, so I'm not sure it's something to attempt until the feature has had more time to mature. It's also something a user might want control over, rather than being the default. 🤔 There's also an oddity that the I think it might be best to explore fixing this for v1 without bubbling. Each pattern instance is self-contained and responsible for its own overrides. Users can still compose patterns, but inner instance overrides aren't editable from the outer instance (that seems to be what @kevin940726 is describing above). |
The editing of the nested patterns in the parent patterns the I have updated the fix PR to show the block with editing disabled instead of showing the Although editing of the nested patterns in the post may be possible with some changes I agree with @talldan that we should limit the complexity for this initial release of this feature and circle back on that later. |
Description
If you have a synced pattern block with overrides and you nest another synced pattern with overrides within it the nested block causes an exception.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Environment info
WP 6.4.2 and GB trunk
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: