-
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
Remove unused terms, taxonomies and categories code #8250
Conversation
packages/core-data/src/selectors.js
Outdated
* | ||
* @return {Array} Categories list. | ||
*/ | ||
export function getTerms( state, taxonomy ) { |
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 guess we should probably leave the code for two releases and add a "deprecated" call to these unused selectors.
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.
PR updated to use deprecated
.
172e14a
to
017597f
Compare
packages/core-data/src/reducer.js
Outdated
version: '13.6.0', | ||
alternative: 'entities reducer', | ||
plugin: 'Gutenberg', | ||
} ); |
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.
The reducers are not public API, so I'd prefer avoiding these two warnings.
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.
aaf9e2e
What should we do with the resolvers?
packages/core-data/src/actions.js
Outdated
@@ -13,6 +14,11 @@ import { castArray } from 'lodash'; | |||
* @return {Object} Action object. | |||
*/ | |||
export function receiveTerms( taxonomy, terms ) { | |||
deprecated( 'receiveTerms action', { |
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.
Can we use the public API in the messages instead?
deprecated( 'wp.data.dispatch("core").receiveTerms', {
version: '13.6.0',
alternative: 'wp.data.dispatch("core").receiveEntityRecords',
plugin: 'Gutenberg',
} );
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.
@@ -24,6 +25,11 @@ import { getKindEntities } from './entities'; | |||
* progress. | |||
*/ | |||
export async function* getCategories() { | |||
deprecated( 'getCategories resolver', { |
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.
Some of these deprecated selectors are used in the core-blocks/README.md
, should we update the docs?
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.
Yeah, we should. Good catch. Is this something you could help with? It's still fuzzy to me how one should work with the entities abstraction. Let me know if you won't have the availability and I'll do it.
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.
Done at ea38313
f6e862c
to
ea38313
Compare
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 also need to add all those deprecations to https://github.com/WordPress/gutenberg/blob/master/docs/reference/deprecated.md. Is it possible to consolidate them into one entry there?
packages/core-data/src/actions.js
Outdated
@@ -13,6 +14,11 @@ import { castArray } from 'lodash'; | |||
* @return {Object} Action object. | |||
*/ | |||
export function receiveTerms( taxonomy, terms ) { | |||
deprecated( 'wp.data.dispatch("core").receiveTerms', { | |||
version: '13.6.0', |
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.
Typo, it should be 3.6.0
. Actually, we should bump to 3.7.0
as we had new release in the meantime.
packages/core-data/src/selectors.js
Outdated
@@ -36,6 +37,11 @@ function isResolving( selectorName, ...args ) { | |||
* @return {Array} Categories list. | |||
*/ | |||
export function getTerms( state, taxonomy ) { | |||
deprecated( 'wp.data.select("core").getTerms', { | |||
version: '13.6.0', |
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.
13.6.0
should be replaced with 3.7.0
everywhere.
bc6c3c9
to
6925f39
Compare
@gziolo @youknowriad updated docs, version, and rebased from master. |
There are 3 unit tests failing. It looks like you don't assert for the warnings introduced with deprecations. In general, we have configured out tests to ensure that printing to the console is under control. Tests will fail unless you explicitly assert for it. when you see:
it means you need to call: expect( console ).toHaveWarned();
// or more detailed
expect( console ).toHaveWarnedWith( 'The message printed to the console' ); |
6925f39
to
020ef51
Compare
Thanks for removing those methods 👍 |
This PR removes code that is no longer used.
Open Questions
How has this been tested?