-
Notifications
You must be signed in to change notification settings - Fork 215
Remove deprecated data controls in favour of those from the @wordpress/data package
#5574
Conversation
|
Size Change: -14 B (0%) Total Size: 864 kB
ℹ️ View Unchanged
|
alexflorisca
left a comment
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.
Hey @mikejolley, ran into an issue when testing this
The all products block seems to think there are no products (even though there definitely are)
Filter blocks alongside it also seem to be broken:
I don't know enough about how @wordpress/data works to suggest why this might be but I'm happy to help you figure it out!
The code looks good though and the Cart quantity selector seems to work fine ok and the tests pass 👍
| return Promise.resolve( '' ); | ||
| } ); | ||
| } ); | ||
| render( <CartBlock /> ); |
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 think the render method should go inside the act() function from the react docs
b1a5d1e to
58a0383
Compare
|
I see the products issue too. I can't figure out why though 🤔 I don't see anything obvious in the diff which would break. I do see |
d2b34db to
c98c635
Compare
|
Found the issue. |
alexflorisca
left a comment
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.
Ah good spot. I wonder why there's 2 methods, from what I know select ran the resolver automatically if there was one specified and waited for it. Anyway good to go 👍


Removes usage of the deprecated functions
selectanddispatchimported from@wordpress/data-controls(deprecated here) and replaces them withcontrols.selectandcontrols.dispatchfrom the@wordpress/datapackage.Fixes #5339
Questions from the issue:
The switch to
@wordpress/datahappened in Gutenberg 9.2, which was part of WordPress 5.6, but controls existed before then.Yes, it's part of schema and collections data-stores, used by All Products block.
The
controlsexport existed in WordPress 5.6 (see here). This is the min supported version of Woo core.Blocks min support is 5.8. Both are satisfied.
Testing
How to test the changes in this Pull Request:
JS tests must also pass. I removed the deprecation assertions from those.
Changelog