-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Core Data: Add the 'getEntitiesConfig' resolver #65871
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
Conversation
|
Size Change: +379 B (+0.02%) Total Size: 1.81 MB
ℹ️ View Unchanged
|
|
This is looking good but it looks like the test failures are probably related. |
|
Love this! It solves the multiple |
a8f2cc4 to
4bd2045
Compare
|
Phew, it took me a while to figure out what the problem with I also rebased this PR. |
|
Flaky tests detected in 384aac1. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11587089428
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Thank you, @ellatrix! I'll resolve two remaining items on the todo list and land this PR. |
| } ); | ||
| } ); | ||
|
|
||
| describe( 'getKindEntities', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The getKindEntities method hasn't existed since #39349.
|
@jorgefilipecosta, do you have any suggestions on where to restore the The |
|
@Mamaduka Why not the resolver? In the selector it would be called excessively, no? |
|
@ellatrix, the resolver only has access to the configs that are dynamically loaded. I assume that
That is precisely why I would like to avoid this if it is doable. |
|
Ah, I guess maybe adding a weak map check would work then. But we can also check with @youknowriad next week and fix it separately. |
|
Create a follow-up issue #66594. |
Co-authored-by: Mamaduka <[email protected]> Co-authored-by: ellatrix <[email protected]> Co-authored-by: youknowriad <[email protected]>
| id, | ||
| ] ); | ||
| if ( isAlreadyResolving ) { | ||
| return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is buggy 🙂 it means resolveSelect will return undefined if there's an existing resolver (instead of boolean). Which is problematic because some post actions might not be added at all during load:
| canCreate && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to return the existing resolver?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've filed an issue: #72798
What?
Supersedes #61101.
PR introduces a resolver for
getEntitiesConfigand replacesgetOrLoadEntitiesConfigwith it.Why?
Currently, if two or more components call
getEntityRecodsimultaneously for an entity with the config loaded from the server, theloadermethod can make duplicate requests. The resolvers keep track of HTTP requests in progress and avoid hitting the same endpoint multiple times.Based on the usages of
getOrLoadEntitiesConfig, it seems better to add a resolver for thegetEntitiesConfigselector.The idea is derived from explorations in #61088.
Todos
getOrLoadEntitiesConfigleftovers.registerSyncConfigs. Maybe we can call it inside the selector?Testing Instructions
CI checks should be green.
Testing Instructions for Keyboard
Same.