Skip to content
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

Merged
merged 5 commits into from Mar 20, 2024

Conversation

gigitux
Copy link
Contributor

@gigitux gigitux commented Mar 20, 2024

Submission Review Guidelines:

Changes proposed in this Pull Request:

Before After
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:

  1. Make sure you have the WooCommerce Beta Tester plugin installed and activated.
  2. Under Tools > WCA Test Helper > Features, make sure customize-store is enabled.
  3. Head over to WooCommerce > Home > Customize your store.
  4. Click on "Start designing" and proceed to the Pattern Assembler.
  5. Click on "Design your homepage".
  6. Switch the various patterns very quickly (check the video).
  7. Ensure that the header and the footer don't disappear.
  8. Go back.
  9. Click on "Choose your Header".
  10. Change it and ensure that the header is highlighted.
  11. Go back.
  12. Click on "Choose your Footer".
  13. Change it and ensure that the header is highlighted.
  14. Go Back.
  15. Click done.
  16. Click view store.
  17. Ensure that all the changes are visible on the frontend

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

CYS: Fix Header/Footer template parts disappear

Comment

@gigitux gigitux added type: bug The issue is a confirmed bug. focus: customize-your-store Issues related to the Customize Your Store onboarding flow. labels Mar 20, 2024
@gigitux gigitux self-assigned this Mar 20, 2024
@gigitux gigitux linked an issue Mar 20, 2024 that may be closed by this pull request
Copy link
Contributor

Hi @albarin, @nefeline,

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:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

Copy link
Member

@nefeline nefeline left a 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.

Copy link
Contributor

github-actions bot commented Mar 20, 2024

Test Results Summary

Commit SHA: aaee897

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 39s
E2E Tests1400021703578m 40s

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.

@gigitux gigitux merged commit 55cd198 into trunk Mar 20, 2024
28 of 32 checks passed
@gigitux gigitux deleted the 45711-cys-header-and-footer-disappear branch March 20, 2024 13:28
@github-actions github-actions bot added this to the 8.8.0 milestone Mar 20, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Mar 20, 2024
@alopezari alopezari added needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: customize-your-store Issues related to the Customize Your Store onboarding flow. needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. status: analysis complete Indicates if a PR has been analysed by Solaris team: Kirigami & Origami type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CYS] Header and Footer disappear
4 participants