-
Notifications
You must be signed in to change notification settings - Fork 221
Product Gallery > Next/Previous Buttons block: Add support to Interactivity API #10938
Product Gallery > Next/Previous Buttons block: Add support to Interactivity API #10938
Conversation
…ck-with-clicked-page-from-the-pager-block
…ck-with-clicked-page-from-the-pager-block
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: +63 B (0%) Total Size: 1.47 MB
ℹ️ View Unchanged
|
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.
Nice work! The PR works excellent, but I think that there are some things to address. Also, since the Interactivity API is WIP, I think that we should add E2E tests to catch any regressions.
}, | ||
}, | ||
actions: { | ||
woocommerce: { | ||
handleClick: ( { context }: Store ) => { | ||
context.woocommerce.selectedImage = context.woocommerce.imageId; | ||
}, | ||
onNextImageButtonClick: ( store: Store ) => { |
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.
Usually, the handler function should have the prefix handle
. What do you think?
onNextImageButtonClick: ( store: Store ) => { | |
handleNextImageButtonClick: ( store: Store ) => { |
Also, we should decide if we want a nested structure or not (#10823 (comment)). Mmm, I don't have a strong preference, but it makes sense if we have a common approach.
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 just changed it from onNext/onPrevious
to handleNext/handlePrevious
so we establish a common pattern to follow
Regarding the nested structure, I believe that since the store is for the entire block (the Product Gallery block), we can leave it flat. However, if there are actions, selectors, or state that should only be used in the context of one of the inner blocks, we can nest them (this way, we make it clear that they should only be used within that specific inner block).
Ops, I just noticed that a lot of code in this PR is in #10736. Please use ZenHub to specify some dependencies between PRs or/and write it in the description PR! 👍 |
…ked-page-from-the-pager-block' into feat/10631-replace-image-in-large-image-block-when-clicking-next-or-previous-button
My bad 🤦 , I connected the issue but forgot to add the dependency, thank you for pointing this out and for reviewing the PR! |
…ck-with-clicked-page-from-the-pager-block
…ck-when-clicking-next-or-previous-button
…ck-when-clicking-next-or-previous-button
…ck-when-clicking-next-or-previous-button
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.
Thanks for working on this, and sorry for the late review. During the review, I noticed that a change introduced a regression. I think that we should fix before merging the PR.
…ck-when-clicking-next-or-previous-button
…ck-when-clicking-next-or-previous-button
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.
Thanks for fixing the arrows on the front end! I noticed that the arrows aren't visible on the editor side:
Screen.Capture.Oct.5.mov
Thank you for pointing this out, I just fixed this in here: e8a9edb |
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.
LGTM!
Thanks for working on this!
I noticed that the PHP linter job step fails. Could you check why, @thealexandrelara? |
…ck-when-clicking-next-or-previous-button
Delete unnecessary file that is causing php cs error
Yes, for some reason a random empty php file was added to the PR, not sure if it is related to the issue that Github is currently facing with PRs, but after removing this file, it worked |
What
This PR adds support to the Interactivity API on the Next/Previous buttons block, allowing shoppers to navigate between the gallery images without having to reload the page.
Fixes #10631
Why
This is part of our effort to implement the new Product Gallery block.
Testing Instructions
Please consider any edge cases this change may have, and also other areas of the product this may impact.
Screenshots or screencast
CleanShot.2023-09-13.at.17.15.42.mp4
WooCommerce Visibility
Required: