Remove unused terms, taxonomies and categories code#8250
Conversation
| * | ||
| * @return {Array} Categories list. | ||
| */ | ||
| export function getTerms( state, taxonomy ) { |
There was a problem hiding this comment.
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.
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.
The reducers are not public API, so I'd prefer avoiding these two warnings.
There was a problem hiding this comment.
aaf9e2e
What should we do with the resolvers?
packages/core-data/src/actions.js
Outdated
| * @return {Object} Action object. | ||
| */ | ||
| export function receiveTerms( taxonomy, terms ) { | ||
| deprecated( 'receiveTerms action', { |
There was a problem hiding this comment.
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',
} );| * progress. | ||
| */ | ||
| export async function* getCategories() { | ||
| deprecated( 'getCategories resolver', { |
There was a problem hiding this comment.
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.
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.
f6e862c to
ea38313
Compare
There was a problem hiding this comment.
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
| */ | ||
| export function receiveTerms( taxonomy, terms ) { | ||
| deprecated( 'wp.data.dispatch("core").receiveTerms', { | ||
| version: '13.6.0', |
There was a problem hiding this comment.
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
| */ | ||
| export function getTerms( state, taxonomy ) { | ||
| deprecated( 'wp.data.select("core").getTerms', { | ||
| version: '13.6.0', |
There was a problem hiding this comment.
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?