This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Product Collection: Use Interactivity API for pagination (#10361)
* Update router to hydrate only interactive regions * Rename link directive to navigation-link * Add navigation directives to Query and Pagination blocks * Enable the Interactivity API by default * Remove client-side navigation meta tag * Cache initial regions * Move data-wc-interactive from query to query-pagination * Add woo prefix to navigation id * Add keys and move wc-interactive back to the query block * Reuse root fragments for each interactive region * Fix navigation-id retrieval * Introduce interactivity to Product Collection block and navigation enhancements This commit brings significant improvements to the ProductCollection block. 1. A new property `parsed_block` is added to the class to hold the block with its attributes before it gets rendered. This allows for more complex manipulations of the block and its attributes. 2. Interactivity has been added to the product collection block. The block is marked as an interactive region so it can be updated during client-side navigation. The `add_navigation_id_directive` method is responsible for adding this functionality. This ensures better UX as users navigate through the products. 3. Navigation links inside the Query Pagination block are also made interactive. The `add_navigation_link_directives` function is responsible for this. All anchor tags in the pagination are given the `data-wc-navigation-link` attribute with relevant navigation payload. This includes prefetching and scroll behavior. The pagination links are given unique keys for 'previous' and 'next' navigation. 4. The `render_block` filter hook has been used to add these functionalities to the product collection and query pagination blocks during render. * Disable scroll --------- Co-authored-by: David Arenas <david.arenas@automattic.com>
- Loading branch information