-
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
Site Editor: Reduce the Amount of Data Passed Through the Components Tree #26463
Conversation
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.
This all looks good to me and the sidebar still works as it did previously. 🥳
I like the structure better overall. With the setTemplate and preview states defined at the item level, things look a bit more clean. Im assuming these are the hooks you were referring to?
packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/templates.js
Outdated
Show resolved
Hide resolved
Actually I've only noticed those while working on this. 😅 What I'm referring to is the
|
8b1c517
to
23bfa10
Compare
Size Change: -57 B (0%) Total Size: 1.2 MB
ℹ️ View Unchanged
|
Description
While working on #26394 I've noticed that having a
TemplateNavigationItems
(plural) component, rendering lists ofNavigationItem
, prevented adding hooks to single items.This led me to a bit of a simplification of the whole Site Editor navigation structure:
TemplateNavigationItem
(singular) component instead, self-containing as much logic as possible, instead of inheriting from various hierarchical levels above.In my initial exploration I've even tried to avoid passing
templates
through, relying ongetEntityRecord
in theTemplateNavigationItem
.This though had the side effect of firing a lot of unnecessary requests (one for the list, and one for each item). I wonder if there's a way to bypass the API and only select from Redux. 🤔
How has this been tested?
Types of changes
Code quality
Checklist: