-
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
Inserter: fix loading indicator for reusable blocks #64839
Conversation
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. |
Size Change: -1 B (0%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
{ per_page: -1 }, | ||
] ) | ||
? reusableBlocks | ||
: undefined; |
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 don't understand this hasFinishedResolution
technique. If there are valid reusableBlocks
in state, but resolution hasn't finished, then the resolution must have been invalidated. And the state contains stale data that we don't want. So we add this condition to avoid getting the stale data. Is that right?
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'm not sure I'm following. Could you elaborate? Sorry
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'm more or less asking why we call hasFinishedResolution
instead of just always returning reusableBlocks
from the selector.
What?
Fixes #64274.
Loading state was introduced in #61513, but was not properly added to the reusable blocks selector.
Why?
If there's only reusable blocks to be fetched, it causes the loading indicator to not appear, instead it will show "no results".
How?
Use the same technique as in #61513 for the reusable blocks selector.
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast