-
Notifications
You must be signed in to change notification settings - Fork 219
Product Gallery block: Migrate to new Interactivity API store #11721
Product Gallery block: Migrate to new Interactivity API store #11721
Conversation
…e-api' into refactor/11656-migrate-product-gallery-block-to-new-interactivity-store-api
5aa0b93
to
92debe0
Compare
There was some missing indexes, which turned the array into an object in JS.
Replace with an interactive block that calls `actions.sel...Replace with an interactive block that calls `actions.selectImage`.
woocommerce-blocks/assets/js/blocks/product-gallery/frontend.tsx Lines 90 to 101 in be34045
🚀 This comment was generated by the automations bot based on a
|
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
assets/js/blocks/collection-filters/inner-blocks/price-filter/frontend.ts
assets/js/blocks/collection-filters/inner-blocks/stock-filter/frontend.ts packages/interactivity-components/dropdown/index.ts |
Size Change: -142 B (0%) Total Size: 1.58 MB
ℹ️ View Unchanged
|
Replace with an interactive block that calls `actions.sel...Replace with an interactive block that calls `actions.selectImage`.
woocommerce-blocks/assets/js/blocks/product-gallery/frontend.tsx Lines 90 to 101 in 5e34e90
🚀 This comment was generated by the automations bot based on a
|
Replace with an interactive block that calls `actions.sel...Replace with an interactive block that calls `actions.selectImage`.
woocommerce-blocks/assets/js/blocks/product-gallery/frontend.tsx Lines 90 to 101 in ecc6712
🚀 This comment was generated by the automations bot based on a
|
Replace with an interactive block that calls `actions.sel...Replace with an interactive block that calls `actions.selectImage`.
woocommerce-blocks/assets/js/blocks/product-gallery/frontend.tsx Lines 90 to 101 in d77e356
🚀 This comment was generated by the automations bot based on a
|
You can move the You can call |
Replace with an interactive block that calls `actions.sel...Replace with an interactive block that calls `actions.selectImage`.
woocommerce-blocks/assets/js/blocks/product-gallery/frontend.tsx Lines 93 to 104 in 5200c89
🚀 This comment was generated by the automations bot based on a
|
Ohh nice! Thank you for your tip, I just pushed the changes with your suggestion! |
Replace with an interactive block that calls `actions.sel...Replace with an interactive block that calls `actions.selectImage`.
woocommerce-blocks/assets/js/blocks/product-gallery/frontend.tsx Lines 93 to 104 in 6808c73
🚀 This comment was generated by the automations bot based on a
|
…grate-product-gallery-block-to-new-interactivity-store-api
I've updated the branch base to interactivity-api-new-store-api and merged it to update and resolve conflicts. EDIT: changed the base branch back to interactivity-api-refactor-product-button-with-new-store-api |
…e-api' into refactor/11656-migrate-product-gallery-block-to-new-interactivity-store-api
Replace with an interactive block that calls `actions.sel...Replace with an interactive block that calls `actions.selectImage`.
woocommerce-blocks/assets/js/blocks/product-gallery/frontend.tsx Lines 93 to 104 in 3361752
🚀 This comment was generated by the automations bot based on a
|
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 left some suggestions that I think should be addressed (maybe in a subsequent PR 🙂).
Replace with an interactive block that calls `actions.sel...Replace with an interactive block that calls `actions.selectImage`.
woocommerce-blocks/assets/js/blocks/product-gallery/frontend.tsx Lines 83 to 94 in a615e6c
🚀 This comment was generated by the automations bot based on a
|
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.
Everything tested nicely and the code looks pretty straight forward! Good job everyone!
c10c777
into
interactivity-api-refactor-product-button-with-new-store-api
…`store()` API (#11558) * Refactor Product Button with new store() API * Use `wc_initial_state` in Product Button * Fix namespace * Remove unnecessary state * Test namespaces in directive paths * Add test context with namespace * Simplify woo-test context * Move addToCart and animations to a file * Do not pass `rawStore` to `afterLoad` callbacks * Move callbacks and actions back to the main file Because the animation was broken. * Remove selectors in favor of state * Use default ns in `getContext` for state and actions * Remove `afterLoad` callback * Remove unnecessary ns * Fix getContext in add-to-cart * Replace namespace and delete unnecessary store * Pass context types only once * Use an alternative for requestIdleCallback * Add previous react code for notices * Add namespace to Product Collection block * Replace getTextButton with getButtonText * Add block name to the ProductCollection namespace * fix style HTML code * Remove circular deps error on the Interactivity API * Product Gallery block: Migrate to new Interactivity API store (#11721) * Migrate Product Gallery block to new Interactivity API store * Fix some references * Add missing data-wc-interactive * Fix an additional namespace * Remove unnecessary click handler * Dialog working * Refactor action names * Reindex PHP array There was some missing indexes, which turned the array into an object in JS. * Remove unused event handlers * Move next/previous logic to external function * Move StorePart util to the types folder * Rename namespace to `woocommerce/product-gallery` * Undo product collection namespace renaming * Remove unnecessary namespace * Don't hide the large image on page load * Minor refactorings * Fix eslint error * Fix php cs errors with spacing and double arrows alignment * Disable no-use-before-define rule for eslint * Disable @typescript-eslint/ban-types rule for eslint * Fix parsed context error in e2e tests * Fix context parser for Thumbnail image * Move store to the top of the frontend file * Add interactivity api utils to the @woocommerce/utils alias * Replace deprecated event attribute --------- Co-authored-by: Luis Herranz <luisherranz@gmail.com> Co-authored-by: David Arenas <david.arenas@automattic.com> Co-authored-by: roykho <roykho77@gmail.com> --------- Co-authored-by: David Arenas <david.arenas@automattic.com> Co-authored-by: Luigi Teschio <gigitux@gmail.com> Co-authored-by: Alexandre Lara <allexandrelara@gmail.com> Co-authored-by: roykho <roykho77@gmail.com>
* Sync Interactivity API code with Gutenberg * New store() API * Store raw actions * Update wc-interactivity-store implementation * Replace `wc_store` with `wc_initial_state` * Parse and populate initial state * Allow store parts in `store()` * Accept namespaces in directive paths * Add $$namespace to directives' object values * Make namespace parsing more robust * Use DeepPartial type for store parts * Do not pass `rawStore` to `afterLoad` callbacks * Simplify `store()` a bit * Implement `privateStore()` * Sync context directive with Gutenberg * Refactor scope and extract getters per scope * Add namespace to getters and actions * Remove current privateStore implementation * Remove `afterLoad` option from `store` * Use same proxy handlers for ns, getters and actions * Set scope inside `evaluate` * Refactor proxy handlers * Improve types a bit * Catch errors in async actions * Implement stacks for scopes and namespaces * Implement `getElement` * Change directives object structure * Remove unnecessary import * Implement private stores * Return value from sync actions * Minor optimizations and improved comments * Don't use async inside `data-wp-watch` * Use a single Provider in context directive * Remove DeepPartial type * Do not check if element exists * Add the `current` prop of state inside the scope * Move getters outside scope * Fix wc-key assignment * Fix missing `navigate` in directives * Fix namespace not being picked in the same element * Deep merge raw stores instead of proxied ones * Fix namespace assignment * Allow forward slashes in namespaces * Migration of Product Collection and Product Button blocks to the new `store()` API (#11558) * Refactor Product Button with new store() API * Use `wc_initial_state` in Product Button * Fix namespace * Remove unnecessary state * Test namespaces in directive paths * Add test context with namespace * Simplify woo-test context * Move addToCart and animations to a file * Do not pass `rawStore` to `afterLoad` callbacks * Move callbacks and actions back to the main file Because the animation was broken. * Remove selectors in favor of state * Use default ns in `getContext` for state and actions * Remove `afterLoad` callback * Remove unnecessary ns * Fix getContext in add-to-cart * Replace namespace and delete unnecessary store * Pass context types only once * Use an alternative for requestIdleCallback * Add previous react code for notices * Add namespace to Product Collection block * Replace getTextButton with getButtonText * Add block name to the ProductCollection namespace * fix style HTML code * Remove circular deps error on the Interactivity API * Product Gallery block: Migrate to new Interactivity API store (#11721) * Migrate Product Gallery block to new Interactivity API store * Fix some references * Add missing data-wc-interactive * Fix an additional namespace * Remove unnecessary click handler * Dialog working * Refactor action names * Reindex PHP array There was some missing indexes, which turned the array into an object in JS. * Remove unused event handlers * Move next/previous logic to external function * Move StorePart util to the types folder * Rename namespace to `woocommerce/product-gallery` * Undo product collection namespace renaming * Remove unnecessary namespace * Don't hide the large image on page load * Minor refactorings * Fix eslint error * Fix php cs errors with spacing and double arrows alignment * Disable no-use-before-define rule for eslint * Disable @typescript-eslint/ban-types rule for eslint * Fix parsed context error in e2e tests * Fix context parser for Thumbnail image * Move store to the top of the frontend file * Add interactivity api utils to the @woocommerce/utils alias * Replace deprecated event attribute --------- Co-authored-by: Luis Herranz <luisherranz@gmail.com> Co-authored-by: David Arenas <david.arenas@automattic.com> Co-authored-by: roykho <roykho77@gmail.com> --------- Co-authored-by: David Arenas <david.arenas@automattic.com> Co-authored-by: Luigi Teschio <gigitux@gmail.com> Co-authored-by: Alexandre Lara <allexandrelara@gmail.com> Co-authored-by: roykho <roykho77@gmail.com> * Fix error when closing product gallery dialog with keyboard escape key * use wc_initial_state instead of wc_store --------- Co-authored-by: Luis Herranz <luisherranz@gmail.com> Co-authored-by: Luigi Teschio <gigitux@gmail.com> Co-authored-by: Alexandre Lara <allexandrelara@gmail.com> Co-authored-by: roykho <roykho77@gmail.com>
Fixes #11656
What
Migrates the Product Gallery block and its inner blocks (Pager, Thumbnails, Large Image blocks) to the new store() API.
Resources:
store()
API #11065store()
API #11071store()
API #11558Why
Because we are switching from the old
store()
API to the newstore()
API, and we need to migrate all the blocks at once.Testing Instructions
WooCommerce Visibility
Required: