-
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
getEntityRecord issues a HTTP request when there's a cached result #24308
Comments
I wonder if this is solved with #19498 which is close to land. |
It seems like it will! Let's confirm once it lands and then hopefully close this issue. Also, in reply to #24290 (comment):
I may be missing something, but it would make sense to me to use the entity we already have (until the cache is invalidated) instead of re-requesting a new one each time. I don't get how it's short-circuiting when the entity is not found - shouldn't that be exactly when the resolution needs to happen?. |
I think you're confusing "Entity" and "Entity Record". "Entity" is just the config of the entity, we're resolving the record at this point. |
Ah I see, it all makes sense now! Awesome, so #19498 will solve this. |
Since #19498 has been merged, this issue should be resolved now :) |
Describe the bug
Consider the following function:
gutenberg/packages/core-data/src/resolvers.js
Lines 54 to 64 in be01420
I would expect it to short-circuit if the entity is found, but it does the opposite which results in extra http queries.
For example, calling:
Will issue two http queries even if the entity with id
sidebar-1
is already available.CC @youknowriad
The text was updated successfully, but these errors were encountered: