-
Notifications
You must be signed in to change notification settings - Fork 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
SPT: move storing to higher component #35618
Conversation
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
190de70
to
a5c6419
Compare
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 like what you've done here. It really improves things thank you. It's much appreciated.
I've tested manually on my local and it works as required.
One thing I've noted is that we have almost no doc blocks on our component functions. We should probably write some...
...ng-plugin/starter-page-templates/page-template-modal/components/template-selector-control.js
Outdated
Show resolved
Hide resolved
...ll-site-editing/full-site-editing-plugin/starter-page-templates/page-template-modal/index.js
Outdated
Show resolved
Hide resolved
...ll-site-editing/full-site-editing-plugin/starter-page-templates/page-template-modal/index.js
Outdated
Show resolved
Hide resolved
...ll-site-editing/full-site-editing-plugin/starter-page-templates/page-template-modal/index.js
Show resolved
Hide resolved
...ll-site-editing/full-site-editing-plugin/starter-page-templates/page-template-modal/index.js
Outdated
Show resolved
Hide resolved
...ll-site-editing/full-site-editing-plugin/starter-page-templates/page-template-modal/index.js
Show resolved
Hide resolved
...ll-site-editing/full-site-editing-plugin/starter-page-templates/page-template-modal/index.js
Outdated
Show resolved
Hide resolved
...ll-site-editing/full-site-editing-plugin/starter-page-templates/page-template-modal/index.js
Outdated
Show resolved
Hide resolved
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 went over the things reported in the review and they now seem to be resolved here and in the new spin-off PR. Thanks for working on it, this one is good to go!
Changes proposed in this Pull Request
This PR move the logic which parses the template content from the
<TemplateSelectorItem />
to the<PageTemplateModal />
.Right now we are processing each template content into its own component (). With processing I mean to get the raw template content (from a component property), parse this content in order to get the blocks, to finally preview them using the component.
In this PR, the templates are re-ordered as an Object which each field is the template slug. This
templates
property is passed to the<PageTemplateModal />
component, and once the component did mount it starts the parsing process, template by template and storing the blocks into the component state (blocks).The blocks state is passed to the
<TemplateSelectorControl />
component through of theblocksByTemplates
property, and this component takes over of iterating for all templates in order to perform the preview (thumbnails).All templates are parsed once, and also we are avoiding storing the blocks for the current preview (large preview) since now we just need the current template slug.
Related Issues: #35233
Test
Apply the patch and check that everything is working as expected.
Maybe use the developer tools to check the props and state of the components.