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
CYS: Fix Header/Footer template parts disappear #45735
Conversation
Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
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.
Great job @gigitux !
Regarding:
This PR fixes the Header/Footer template parts disappear, or at least, greatly reduces the chances of this happening.
This issue happens because, for some reason, the innerBlocks of the template part block became 0 (source code).
This looks like a bug (WordPress/gutenberg#20243) within the code responsible for synchronizing inner blocks on every change: https://github.com/WordPress/gutenberg/blob/0c176fef1896ee5264526601825a81b229d9ddd2/packages/block-editor/src/components/inner-blocks/use-inner-block-template-sync.js/#L56-L113.
In this PR, I removed all the changes we applied to the blocks array, passing the original one returned by the hook. I imagine that some optimizations are checking the reference.
Futhermore, I added a check on SidebarNavigationScreenHomepage to trigger the onChange only when the pattern is changed.
Thanks for the detailed explanation of the problem at hand and the proposed solution. My tests of this PR were all successful, tested multiple times with different combinations of headers, footers and homepages, so we can proceed with this implementation and circle back in case new reports come up later.
…ocommerce/woocommerce into 45711-cys-header-and-footer-disappear
Test Results SummaryCommit SHA: aaee897
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
…-cys-header-and-footer-disappear
Submission Review Guidelines:
Changes proposed in this Pull Request:
qtWb5l.mp4
PDRFMI.mp4
This PR fixes the Header/Footer template parts disappear, or at least, greatly reduces the chances of this happening.
This issue happens because, for some reason, the
innerBlocks
of the template part block became 0 (source code).This looks like a bug (WordPress/gutenberg#20243) within the code responsible for synchronizing inner blocks on every change: https://github.com/WordPress/gutenberg/blob/0c176fef1896ee5264526601825a81b229d9ddd2/packages/block-editor/src/components/inner-blocks/use-inner-block-template-sync.js/#L56-L113.
In this PR, I removed all the changes we applied to the blocks array, passing the original one returned by the hook. I imagine that some optimizations are checking the reference.
Futhermore, I added a check on
SidebarNavigationScreenHomepage
to trigger the onChange only when the pattern is changed.Closes #45711 .
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
Changelog entry
Significance
Type
Message
CYS: Fix Header/Footer template parts disappear
Comment