Skip to content
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

resolveSelect doesn't work inside data store resolvers, select throws warnings #68679

Open
3 of 6 tasks
danieliser opened this issue Jan 15, 2025 · 2 comments
Open
3 of 6 tasks
Labels
Needs Technical Feedback Needs testing from a developer perspective. [Package] Data /packages/data [Type] Bug An existing feature does not function as intended

Comments

@danieliser
Copy link
Contributor

danieliser commented Jan 15, 2025

Description

Have some custom data stores in a plugin, for some time now our fully TS data store package shows notices of

`select` control in `@wordpress/data-controls` is deprecated since version 5.7. Please use built-in `resolveSelect` control in `@wordpress/data` instead.

Ok so I spent a couple hours replacing everything, seems simple enough as select just passes through to resolveSelect.

Its currently yield*, but I've tried normal yield as well, await simply doesn't seem to work within generators without lots of extra work wrapping every call with call( async () => {} )**

After swapping them out though, the generators stopped working for all resolvers.

I'm not sure what this deprecated notice is about, but it seems like a misleading notice here, clearly something else happening.

Side note, the typing for the resolveSelect is kinda terrible, why not have it simply return selector for given data store?

We have fully working type overloads for select, dispatch etc for our custom data stores, so I imagine it could be done in core in an interface pretty easily and ready to extend.

Step-by-step reproduction instructions

Consume resolveSelect within a generator for Redux data store resolver. It doesn't work from my testing, but using select which does work throws notices.

Screenshots, screen recording, code snippet

No response

Environment info

  • Latest Gutenberg plugin, have dev version too.
  • Latest WP core.

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@danieliser danieliser added the [Type] Bug An existing feature does not function as intended label Jan 15, 2025
@Mamaduka Mamaduka added [Package] Data /packages/data Needs Technical Feedback Needs testing from a developer perspective. labels Jan 15, 2025
@Mamaduka
Copy link
Member

@danieliser, check out the PR introducing deprecation for the @wordpress/data-controls package. It also lists a couple of migration PRs for core - #26509.

All block editor stores also switched from "generators" to "thunks" a while ago, which are much easier to work with, in my opinion. You can read more about this change here - https://developer.wordpress.org/block-editor/how-to-guides/thunks/.

@danieliser
Copy link
Contributor Author

@Mamaduka Many thanks. I've tried to address this on multiple ocassions.

Will give those read and report back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Technical Feedback Needs testing from a developer perspective. [Package] Data /packages/data [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants