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 crash Product Collection block #47511

Conversation

gigitux
Copy link
Contributor

@gigitux gigitux commented May 15, 2024

Submission Review Guidelines:

Changes proposed in this Pull Request:

As described in #47469, the Product Collection block crashes on the homepage pattern previews. This happens because the templateSlug is undefined and this case hasn't been handled. This PR ensure that templateSlug is defined.

Closes #47469.

Before After
image image

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Head over to WooCommerce > Home > Customize your store.
  2. Click on "Start designing" and proceed to the Pattern Assembler.
  3. Click on "Design your Homepage".
  4. Ensure that the Product Collection block doesn't crash in the patterns.

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 crash Product Collection block

Comment

@gigitux gigitux added type: bug The issue is a confirmed bug. block: product collection Issues related to the Product Collection block focus: customize-your-store Issues related to the Customize Your Store onboarding flow. labels May 15, 2024
@gigitux gigitux self-assigned this May 15, 2024
@woocommercebot woocommercebot requested a review from a team May 15, 2024 14:25
Copy link
Contributor

github-actions bot commented May 15, 2024

Hi @albarin, @nefeline, @imanish003, @kmanijak, @woocommerce/woo-fse

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

@@ -40,6 +40,10 @@ export const useTracksLocation = ( templateSlug: string ) => {
return postType;
}

if ( ! templateSlug ) {
return Locations.OTHER;
Copy link
Contributor Author

@gigitux gigitux May 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that this is correct, before merging the PR let's wait for @kmanijak and @imanish003 feedback.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @gigitux , it's a correct fix but it's a duplicate to this one by @imanish003 : #47504.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the other PR has some conflicts. I'll resolve them and merge the other PR to unlock you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @kmanijak! 🚀

I'm going to close this PR!

Copy link
Contributor

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Test this pull request with WordPress Playground.

Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit.

@gigitux gigitux closed this May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
block: product collection Issues related to the Product Collection block focus: customize-your-store Issues related to the Customize Your Store onboarding flow. type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CYS - Product Collection: On the homepage preview, the Product Collection isn't rendered correctly
2 participants