-
Notifications
You must be signed in to change notification settings - Fork 4.4k
ServerSideRender: Colocate delayed spinner logic #70147
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
|
||
useEffect( () => { | ||
if ( ! isLoading ) { | ||
setShowLoader( false ); |
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.
Note: This is just a safeguard for the future. Currently, the component will unmount when isLoading
settles on false
.
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. |
@@ -221,7 +227,7 @@ export default function ServerSideRender( props ) { | |||
|
|||
if ( isLoading ) { | |||
return ( | |||
<LoadingResponsePlaceholder { ...props } showLoader={ showLoader }> | |||
<LoadingResponsePlaceholder { ...props } isLoading={ isLoading }> |
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.
Minor, but if we're worried about back-compat, I can revert the prop name, or just add a changelog entry about it.
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 think this component is rendered when isLoading
is true
, so won't the value of the isLoading
prop always be true
?
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.
That's true, mostly passing the value as a safeguard for future changes. Same as here - #70147 (comment).
Size Change: +17 B (0%) Total Size: 1.85 MB
ℹ️ View Unchanged
|
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.
LGTM!
Minor, but if we're worried about back-compat, I can revert the prop name, or just add a changelog entry about it.
As far as I can tell, I don't believe there are any consumers that use this prop, but I think we'll need to add a CHANGELOG entry at least.
Thanks, @t-hamano! |
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org>
What?
PR updates
ServerSideRender
and moves the delayed snipper logic inside the loading placeholder component.Why?
LoadingResponsePlaceholder
.Testing Instructions
Testing Instructions for Keyboard
Same.