-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
Fix: handle undefined templateSlug in Product Collection tracking utils #47504
Fix: handle undefined templateSlug in Product Collection tracking utils #47504
Conversation
The modification introduces a check for templateSlug before attempting to access its properties or use it in further logic. This change addresses a bug that manifested when users tried to edit a synchronized Product Collection block, resulting in a JavaScript error because templateSlug could be undefined.
Hi @xristos3490, @kmanijak, 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: |
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. 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. |
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.
Works as expected 👌
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.
Works as expected. Thanks for taking care of it!
…tern-with-product-collection-block
…tern-with-product-collection-block
Changes proposed in this Pull Request:
The modification introduces a check for templateSlug before attempting to access its properties or use it in further logic. This change addresses a bug that manifested when users tried to edit Product Collection block in Sync Pattern, resulting in a JavaScript error because templateSlug could be undefined.
Closes #47502
How to test the changes in this Pull Request:
Go to "Products by category" template & add product collection block to it.
Create a sync pattern with Product Collection block inside it.
Select sync pattern and click on "Edit original" in toolbar as shown in screenshot below
Verify that the following error isn't occurring when the Sync pattern is loaded in Editor.
Developer only testing: Verify that you are able to reproduce this issue on
trunk
but not on this PR branch.Changelog entry
Significance
Type
Message
Fix: handle undefined templateSlug in Product Collection tracking utils
Comment