-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Packages: Make usage of core-data
explicit
#8911
Conversation
By the way, |
I think we should do that for all stores regardless of whether these modules are already imported for components etc... For example |
I asked about that in #8354, I tend to agree with the proposal of making all those imports explicit in the entry file for the package. This way it should be lintable if we agree we want to do it. |
When looking at adding explicit dependencies, I discovered that it would produce cyclic dependency between https://github.com/WordPress/gutenberg/blob/master/packages/data/src/registry.js#L195-L196 |
It turns out that:
It is confusing but is what it is. Nothing to worry about :) |
Will review in more detail shortly, but are these all of the data dependencies we have? There's also a new merge conflict which needs to be resolved. |
35f143b
to
19436fa
Compare
I noticed that we should be using
I think only |
Clearing the milestone because this has no impact on the WordPress scripts. |
19436fa
to
b996fa2
Compare
I rebased it with master, can we move forward with it? I think the long-term solution is going to be established with #8981. However, it's not a priority at the moment. |
import '@wordpress/blocks'; | ||
import '@wordpress/core-data'; | ||
import '@wordpress/nux'; | ||
import '@wordpress/viewport'; |
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 edit-post
also uses a bunch of stores, should we add theme there as well?
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.
Added in 2c4f0b0.
b996fa2
to
2c4f0b0
Compare
@@ -1,6 +1,9 @@ | |||
/** | |||
* WordPress dependencies | |||
*/ | |||
import '@wordpress/core-data'; | |||
import '@wordpress/editor'; | |||
import '@wordpress/nux'; |
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.
viewport?
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.
There is no explicit usage in the module so I missed it ...
I will fix.
We need to figure a more robust way 😄
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.
There is no explicit usage in the module so I missed it ...
This confused me a bit. If there's not explicit usage, the module shouldn't need to define it?
But in looking closer, there is explicit usage:
gutenberg/edit-post/store/effects.js
Line 142 in d7eb4f6
const isMobileViewPort = () => select( 'core/viewport' ).isViewportMatch( '< medium' ); |
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.
It was all my fault, I didn't grep properly ...
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.
We may have missed some but I'm approving regardless, we can tweak over time until we find a better approach (no global)
@@ -20,8 +20,7 @@ | |||
"module": "build-module/index.js", | |||
"react-native": "src/index", | |||
"dependencies": { | |||
"@babel/runtime": "^7.0.0-beta.52", | |||
"@wordpress/api-fetch": "file:../api-fetch", | |||
"@babel/runtime-corejs2": "7.0.0-beta.56", |
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.
There are local changes to master after npm install
with these changes. I think we missed an update to package-lock.json
.
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 was wondering if there is a way to catch this kind of issue on Travis and fail the build. It isn’t first time when it happens.
Description
This PR tries to make usage of
@wordpress/core-data
more explicit. When evaluating #8354 and trying to update all blocks to not have direct API calls I figured out that:@wordpress/api-fetch
in the code but we still list it as dependency@wordpress/core-data
isn't initialized for@wordpress/block-library
and@wordpress/editor
which might create some issues when using packages outside of WordPressI also included the change which changes the description of
@wordpress/block-library
package which we missed last week.