-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
Fixed Taxonomy Term Limit On Product Collection Filters #47155
Fixed Taxonomy Term Limit On Product Collection Filters #47155
Conversation
In the interest of avoiding pagination, this refactor replaces the `useEntityRecords` hook with direct requests to the data store. We are now loading the terms from the set IDs and the search query and relying on those instead of a cache of all terms.
We're going to parse it into a Term object so that we can use it to make determinations about whether there is a duplicate or not.
In an effort to clean up the presentation I have removed the term ID from the display output.
Hi @Aljullu, 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: |
TaxonomyItem
When rendering a term that has a duplicate name we will also display the ID to differentiate between them.
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 improvement! I tested it and everything works as expected. The code looks good as well.
I left a couple of suggestions, but pre-approving anyway. I also think it would be a good idea to add automated tests to make sure the duplicate taxonomies and missing taxonomies are rendered with the correct labels. But I don't think it should block this PR as those tests didn't exist before anyway.
plugins/woocommerce/changelog/fix-46850-collection-taxonomy-filter-pagination
Outdated
Show resolved
Hide resolved
...ets/js/blocks/product-collection/edit/inspector-controls/taxonomy-controls/taxonomy-item.tsx
Outdated
Show resolved
Hide resolved
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. |
In the interest of avoiding pagination this refactor swaps the current term loading with one that doesn't require a cache of all terms. We've removed the need for the cache by storing the ID and term name together in the token/suggestion list and using a display transformation to hide any unnecessary information.
Submission Review Guidelines:
Changes proposed in this Pull Request:
This pull request refactors the
TaxonomyItem
component. Previously,useEntityRecords
was used to populate a cache of all of the terms, but without any pagination, this list only contains the first 10 terms. We don't really need this cache since the query for existing terms and search terms will provide all of the information we need to display suggestions and render tokens. With this in mind I have moved towards usinggetEntityRecords
directly from the data store. I was also able to reduce the amount of code in the process.There are now three different presentations for term names:
Closes #46850.
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
Changelog entry
Significance
Type
Message
Comment