-
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
Possible unintended interaction with duplicating a query loop block. #46079
Comments
The full-site editor would likely prove using instanceId as unreliable for requiring a truly unique queryId. Perhaps prefixing it based on edit context (edit-post vs edit-site) could help. |
This issue was reviewed in today's Editor Bug Scrub. We were able to replicate and also confirmed that manually changing the |
Thanks for the issue @albanyacademy!
There is an issue about this here with lots of discussions and explorations, but haven't made it to the finish line. We'd have to revisit this. |
Just getting back to this, __experimentalRole:"internal" is a great idea. |
Thanks for reporting and your thorough work; there's additional context and work on this at #55823 so I'm closing this issue to consolidate reports and efforts. |
Description
When duplicating a query loop block, a query ID is also duplicated along with it.
This means that on the page, things like pagination or taxonomy filtering gets applied to all of the duplicated blocks.
The average (re: lazy) user will likely want to duplicate a block they've spent time carefully crafting, so this interaction may not be what they have in mind when they do this. There's also zero feedback to the user that this linked effect is taking place, they can only observe it on the front end.
This behaviour is also true when copying and pasting, or when converting a query block stored as a Reusable block back into a regular block.
There's definitely a use case for having multiple query blocks respond to the same query, though for the most part I would suggest that this shouldn't be the default behaviour - that should be an explicit user action, and they should be allowed to specify which Query Blocks are linked (i.e. share the same query).
Something like this would address it:
At query-block/edit/query-content.js
As an aside, outside of the query block afaik there's not really any support for the concept of a "unique" attribute either - such as auto-generating an element ID in a custom block - within the context of editing a page. It would be good to have this set to an attribute property, ala:
"blockId": { "type":"string", "isUnique": true }
I'm not sure how much of a valid use case there is with the builtin blocks beyond query block for such a feature, and for customizing blocks it's easy enough to add it yourself, but food for thought.
Step-by-step reproduction instructions
observe on the front end that pagination is applied to all query blocks added via the above method.
Screenshots, screen recording, code snippet
No response
Environment info
No response
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: