-
Notifications
You must be signed in to change notification settings - Fork 215
Migrate Featured Items Blocks to TypeScript #6439
Migrate Featured Items Blocks to TypeScript #6439
Conversation
|
Size Change: +70 B (0%) Total Size: 862 kB
ℹ️ View Unchanged
|
Refactored some composed components into one inclusive HOC, called `withUpdateButtonAttributes`.
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.
…/6237-6238-featured-items-typescript
The HOC `withTransformSingleSelectToMultipleSelect` allows for the wrong type to be passed to its wrapped component: if a single element is passed, that is wrapped into an array. This didn't play well with TypeScript which obviously complains about the wrong type being passed to the component. So we now allow for empty arrays to be passed and parsed as "nil".
Convert `ProductControl` to TypeScript eslint-disable-nex...Convert `ProductControl` to TypeScript eslint-disable-next-line @typescript-eslint/ban-ts-comment @ts-ignore
woocommerce-blocks/assets/js/blocks/featured-items/with-edit-mode.tsx Lines 107 to 123 in f3bc88a
🚀 This comment was generated by the automations bot based on a
|
Convert `ProductCategoryControl` to TypeScript eslint-dis...Convert `ProductCategoryControl` to TypeScript eslint-disable-next-line @typescript-eslint/ban-ts-comment @ts-ignore
woocommerce-blocks/assets/js/blocks/featured-items/with-edit-mode.tsx Lines 78 to 91 in f3bc88a
🚀 This comment was generated by the automations bot based on a
|
|
@frontdevde @albarin Feedback addressed! |
|
I'm still seeing the same block error (see above) when I'm trying to insert the Featured Product block on this branch (not on trunk). Can you reproduce that issue? |
Convert `ProductCategoryControl` to TypeScript eslint-dis...Convert `ProductCategoryControl` to TypeScript eslint-disable-next-line @typescript-eslint/ban-ts-comment @ts-ignore
woocommerce-blocks/assets/js/blocks/featured-items/with-edit-mode.tsx Lines 78 to 91 in 5d280cf
🚀 This comment was generated by the automations bot based on a
|
Convert `ProductControl` to TypeScript eslint-disable-nex...Convert `ProductControl` to TypeScript eslint-disable-next-line @typescript-eslint/ban-ts-comment @ts-ignore
woocommerce-blocks/assets/js/blocks/featured-items/with-edit-mode.tsx Lines 107 to 123 in 5d280cf
🚀 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.
Thank you for this valiant effort and for addressing the feedback!
When retesting with the most recent changes functionally everything appears to be working as expected. Let's get this in as the improvement over the status quo it is and iterate on anything else from there.



This PR migrates the
FeaturedItemblocks to TypeScript. I tried to keep the runtime changes at a bare minimum. A few very minor of them were required. The biggest one was the refactoring of two pieces of code that were once again duplicates and also a bit hard to reason with (especially with TypeScript). These were refactored intowith-update-button-attributes.tsx, wherewithSelectwas also updated to use the more modernuseSelecthook approach.All the rest is adding the most type safety I could muster, and working around some upstream type limitations.
Fixes #6237, #6238
Testing
Automated Tests
User Facing Testing
Only regression testing is needed for this PR. The changes introduced in this PR should be compared with a version without those changes and verified that no behavior has changed.
WooCommerce Visibility