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

Taxonomiees: Improve Tags/Categories response size by limiting the requested fields #4167

Merged
merged 1 commit into from Dec 27, 2017

Conversation

youknowriad
Copy link
Contributor

closes #3913

Request only the required data from the taxonomies endpoints.

Testing instructions

  • Create a post
  • Create a tag
  • Type in the tags input
  • Check that the triggered requests only return idand name for each tag
  • Assign tags and check that it saves properly.

Copy link
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests well for me 👍

@youknowriad youknowriad merged commit ebf841f into master Dec 27, 2017
@youknowriad youknowriad deleted the update/tags-categories-request branch December 27, 2017 08:05
@adamsilverstein
Copy link
Member

Great!

@aduth
Copy link
Member

aduth commented Jan 3, 2018

Noting that withAPIData has built-in options for caching requests, so varying the ?_fields parameter would be treated as a separate request.

@adamsilverstein
Copy link
Member

@aduth that should be fine here though, right? since the ?_fields won't change? i'm not sure these requests should be cached because terms could change on the server and you would have to flush the cache (reload?) to pick up changes?

@aduth
Copy link
Member

aduth commented Jan 3, 2018

I guess in this case there's no difference since the hierarchical and non-hierarchical term selectors are querying different data anyways (categories vs. tags), but in other cases we're reusing the same data across many components so filtering fields could cause multiple requests unintentionally.

i'm not sure these requests should be cached because terms could change on the server and you would have to flush the cache (reload?) to pick up changes?

...Something something hard things in computer science 😄

To the previous point, however, we definitely don't want to be firing 20 requests for the same endpoint just because 20 components happen to be using the data. Some amount of caching is quite reasonable to expect.

@adamsilverstein
Copy link
Member

Some amount of caching is quite reasonable to expect.

Absolutely! The caching you describe sounds ideal. Also, thanks for the link to the hard things source, I had only seen some of the riffs.

In this case the request is an admin side search so minimal/no caching seems appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tag search should only retrieve required data
4 participants