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

Fetch all potential categories, attachments, and tags #10873

Closed
danielbachhuber opened this issue Oct 21, 2018 · 3 comments
Closed

Fetch all potential categories, attachments, and tags #10873

danielbachhuber opened this issue Oct 21, 2018 · 3 comments
Labels
[Package] Core data /packages/core-data REST API Interaction Related to REST API [Type] Bug An existing feature does not function as intended

Comments

@danielbachhuber
Copy link
Member

danielbachhuber commented Oct 21, 2018

There are a few API fetch instances using per_page=100 that should instead fetch all of their items:

  1. getAttachmentsCollection() in packages/edit-post/src/hooks/components/media-upload/index.js: 0a08388

  2. The following code in FlatTermSelector: Fetch all terms linked to a post, rather than just first 100 #11524

this.initRequest = this.fetchTerms( {
	include: this.props.terms.join( ',' ),
	per_page: 100,
} );

Even though it's unlikely a user will have 101 tags, Gutenberg will silently discard their 101st tag as fetchTerms() is currently implemented.

  1. componentWillMount() in packages/block-library/src/latest-posts/edit.js: Run the E2E tests as a user with the author role #11359 (comment)

From https://github.com/WordPress/gutenberg/pull/10762/files/8803b88e7e7eed8f73aba32b52608175b1a2e858#diff-781b45da3dbed5d2670d2c98e473fb83

@danielbachhuber danielbachhuber added [Type] Bug An existing feature does not function as intended [Package] Core data /packages/core-data labels Oct 21, 2018
@danielbachhuber danielbachhuber added this to the 4.2 milestone Oct 21, 2018
@danielbachhuber danielbachhuber added the REST API Interaction Related to REST API label Oct 25, 2018
@youknowriad youknowriad modified the milestones: 4.2, WordPress 5.0 Oct 26, 2018
@danielbachhuber danielbachhuber changed the title Fetch all potential attachments and tags Fetch all potential categories, attachments, and tags Nov 5, 2018
@dd32
Copy link
Member

dd32 commented Nov 6, 2018

#11524 is me testing out the changes needed here.

I've verified that Item 2 in FlatTermSelector was indeed an issue, and patched that.

I've been looking into Item 1, but I've been struggling to actually trigger the problematic code.

@danielbachhuber
Copy link
Member Author

I've been looking into Item 1, but I've been struggling to actually trigger the problematic code.

@dd32 This has some fun origins:

I think what getAttachmentsCollection() is meant to do is prime the attachment data used in the Media Library. I also believe that, if the attachment data is missing, the Media Library will refetch it.

@joemcgill Does this match your understanding?

@danielbachhuber
Copy link
Member Author

The two remaining issues were addressed in #11654 and #11655

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Core data /packages/core-data REST API Interaction Related to REST API [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants