Skip to content

Conversation

@jorgefilipecosta
Copy link
Member

@jorgefilipecosta jorgefilipecosta commented Dec 18, 2018

Fixes: #12649
Props to @danielbachhuber, @VadymPogorelov, and @realworldev for the debugging and testing code.

Description

In the taxonomies data request present in the PostTaxonomies component we had a per-page config of -1 to request all the taxonomies.
https://github.com/WordPress/gutenberg/blob/master/packages/editor/src/components/post-taxonomies/index.js#L41

But on the checking component that verifies the post type relationship with the taxonomies we did set the per page config of -1 so only ten taxonomies were being requested.

How has this been tested?

I added the following code snippet for testing purposes:

add_action( 'init', function() {
	for ( $j=0; $j < 12; $j++ ) {
		register_post_type( 'cpt_' . $j, array(
			'label' => 'cpt ' . $j,
			'show_in_rest' => true,
			'public' => true,
		) );
		for ( $i=0; $i < 4; $i++ ) {
			register_taxonomy( 'taxonomy_' . $j . '_' . $i, 'cpt_' . $j, array(
				'label' => 'taxonomy ' . $j . ' ' .$i,
				'show_in_rest' => true,
			) );
		}
	}
});

I verified that even in CPT greater than 2 the taxnomies appear as expected, on master that's not the case.

@jorgefilipecosta jorgefilipecosta added [Type] Bug An existing feature does not function as intended [Package] Editor /packages/editor labels Dec 18, 2018
@jorgefilipecosta jorgefilipecosta added this to the 4.8 milestone Dec 18, 2018
@youknowriad
Copy link
Contributor

Would you mind rebasing to retrigger the tests?

@jorgefilipecosta jorgefilipecosta force-pushed the fix/only-ten-taxonomies-with-show_in_rest-available-in-the-editors-sidebar branch from dda7890 to 220c280 Compare December 20, 2018 12:57
@jorgefilipecosta
Copy link
Member Author

The tests passed, I'm going to merge this PR.

@jorgefilipecosta jorgefilipecosta merged commit a897e05 into master Dec 20, 2018
@jorgefilipecosta jorgefilipecosta deleted the fix/only-ten-taxonomies-with-show_in_rest-available-in-the-editors-sidebar branch December 20, 2018 13:37
@realworldev
Copy link

@jorgefilipecosta Props zu @realworldev for the code snippet for testing.

@jorgefilipecosta
Copy link
Member Author

Sorry @realworldev, I missed your nickname. The description was corrected. Thank you for the code snippet it was very useful 👍

youknowriad pushed a commit that referenced this pull request Jan 3, 2019
… sidebar (#12971)

Fixes: #12649
Props to @danielbachhuber and @VadymPogorelov for the debugging.


## Description
In the taxomies data request present in the PostTaxonomies component we had a per-page config of -1 to request all the taxonomies.
https://github.com/WordPress/gutenberg/blob/master/packages/editor/src/components/post-taxonomies/index.js#L41 

But on the checking component that verifies the post type relationship with the taxonomies we did set the per page config of -1 so only ten taxonomies were being requested.

## How has this been tested?
I added the following code snippet for testing purposes:
```
add_action( 'init', function() {
	for ( $j=0; $j < 12; $j++ ) {
		register_post_type( 'cpt_' . $j, array(
			'label' => 'cpt ' . $j,
			'show_in_rest' => true,
			'public' => true,
		) );
		for ( $i=0; $i < 4; $i++ ) {
			register_taxonomy( 'taxonomy_' . $j . '_' . $i, 'cpt_' . $j, array(
				'label' => 'taxonomy ' . $j . ' ' .$i,
				'show_in_rest' => true,
			) );
		}
	}
});
```
I verified that even in CPT greater than 2 the taxnomies appear as expected, on master that's not the case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants