-
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
Fix warning when a template calls a template area twice #54861
Conversation
Size Change: +585 B (0%) Total Size: 1.62 MB
ℹ️ View Unchanged
|
@MaggieCabrera, I've got an alternative fix for this - #54863. I was just typing the description and noticed your PR. |
yours feels like more sensible approach. I'm assuming we want the same template part to show up twice then? |
It sort of makes sense to me, if we assume the "Areas" component is mini-"List View". @ramonjd or @kevin940726 might have a definitive answer here as they build the components. |
I see this Areas component more as a shortcuts view to dive into the available template parts, not a detailed list view. I think it's fine to not render the same template part twice. |
Indifferent of wether we want to show the template part twice or not, I wonder if the solution here produces the expected resutl: the function should return the complete list, or be named to contain "unique" and make sure we always want it to return unique items. If we want to do what @richtabor says I think a combo of @Mamaduka 's pr to safeguard in the future (using a better key) and also filter for uniqueness closer to the rendered component not directly in the selector? |
Thanks for the quick PR @MaggieCabrera I've just tested and approved #54863 I think it might be useful to know as a consumer of the selectors how many duplicates there are, so maybe we could leave it late (in the UI components) to decide whether to filter them or not (?) That's just my opinion - open to alternatives. |
Since #54863 is merged we may want to change this PR to simply be about the visual update @richtabor proposed of showing same template part once. |
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.
I updated the description. I think we can merge this.
I don’t understand. Did we agree that it was okay to change public function signature? I don’t mind change but things like this should be communicated. Edit: Sorry, I just realized that this came out as an angry comment. It wasn't my intention. But I think @draganescu has a valid point (#54861 (comment)). |
…)" This reverts commit f637b37.
Sorry I didn't fully grok @draganescu's comment. Let's revert this and move the filter closer to the rendered component. |
Thank you, @scruffian! |
Another attempt at this here: #54942 |
Thank you for pointing out my mistake :) |
What?
This PR removes duplicate template areas from the sidebar when in Site View.
The list of areas is based on the template parts used on the page, but we may use some template parts twice.
Why?
We only want to display these template areas and corresponding parts once in the sidebar even if they are used multiple times.
How?
By making sure that
getFilteredTemplatePartBlocks
only returns one instance of eachtemplateId
, making them uniqueScreenshot