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

wp.data Overview #8354

Closed
6 tasks done
mtias opened this issue Aug 1, 2018 · 6 comments
Closed
6 tasks done

wp.data Overview #8354

mtias opened this issue Aug 1, 2018 · 6 comments
Assignees
Labels
[Package] Data /packages/data [Type] Task Issues or PRs that have been broken down into an individual action to take
Milestone

Comments

@mtias
Copy link
Member

mtias commented Aug 1, 2018

This issue seeks to organize pending work and improvements around the wp.data module.

Tasks

Blocks

  • Update all blocks to not have direct API calls.
@mtias mtias added [Type] Task Issues or PRs that have been broken down into an individual action to take [Package] Data /packages/data labels Aug 1, 2018
@gziolo
Copy link
Member

gziolo commented Aug 13, 2018

There are no breaking changes planned, removing from API freeze.

@gziolo
Copy link
Member

gziolo commented Aug 13, 2018

I opened #8911 which explicitly imports @wordpress/core-data for packages which call select( 'core' ).*.

I also noticed the following when looking at the implementation of core-data:

  • isPreviewEmbedFallback, getEmbedPreview are used only with embeds block
  • getThemeSupports is used with editor package
  • getAuthors - referenced only in editor
  • getUserQueryResults - should be internal as it is used only in getAuthors...
  • everything else is entity based
  • it's not possible to customize entities, we use defaultEntities and kinds as provided by core

The general question is, what should be the strategy for including stores in a given package. In other words, how do we want to ensure that each package works out of the box with all the selectors and action it has listed in the codebase.

@youknowriad
Copy link
Contributor

The original purpose oof core-data is a data abstraction for WordPress which includes all the data available via REST API (exclusing plugins data):

  • Posts
  • Users
  • Taxonomies
  • Media
  • Embed Proxy Endpoint
  • Settings (theme supports)

So I think these make sense there.

Extending entities:

  • I'm not certain yet we should make the entities extensible or instead provide helpers to build entities in other data packages. (for example woo/data)

The general question is, what should be the strategy for including stores in a given package. In other words, how do we want to ensure that each package works out of the box with all the selectors and action it has listed in the codebase.

I think explicitness (adding import '@wordpress/core-data' etc...) should be favored but there's an open question about how to detect/automate those. (Maybe an eslint rule is possible)

@coderkevin
Copy link
Contributor

I've done some experimental work to add some more advanced functionality via the fresh-data project.

This is with a plugin internal to @wordpress/data
#8754

This is with the plugin external from @wordpress/data
woocommerce/woocommerce-admin#301

In all, the plugin architecture allowed me to get done what I needed to do this, even with the few key differences in architecture, such as component data mapping, requirements fulfillment, and multi-resource operations.

@coderkevin
Copy link
Contributor

coderkevin commented Aug 21, 2018

I'm also working on some experimental code for a single plugin to hold a larger tree of state within the Calypso project. The goal here is to allow a @wordpress/data workflow while maintaining compatibility with the existing system. Automattic/wp-calypso#26838

@mtias mtias added this to the API Freeze milestone Oct 7, 2018
@youknowriad
Copy link
Contributor

youknowriad commented Oct 27, 2018

Most of the basic pieces landed or are going to land in #10089 I'm closing this meta issue for now. It served its purpose.

There are still things I want to improve on the data module but it could happen later without breaking changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Data /packages/data [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

No branches or pull requests

5 participants