From 84c77131969aafbf0182adc2a5ec8a768afff84e Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Fri, 24 Dec 2021 16:25:15 +0400 Subject: [PATCH] ServerSideRender: Fix loading state --- .../server-side-render/src/server-side-render.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/server-side-render/src/server-side-render.js b/packages/server-side-render/src/server-side-render.js index 06b67d7f62d0d..35338196f6c2b 100644 --- a/packages/server-side-render/src/server-side-render.js +++ b/packages/server-side-render/src/server-side-render.js @@ -182,14 +182,6 @@ export default function ServerSideRender( props ) { const hasEmptyResponse = response === ''; const hasError = response?.error; - if ( hasEmptyResponse || ! hasResponse ) { - return ; - } - - if ( hasError ) { - return ; - } - if ( isLoading ) { return ( @@ -200,5 +192,13 @@ export default function ServerSideRender( props ) { ); } + if ( hasEmptyResponse || ! hasResponse ) { + return ; + } + + if ( hasError ) { + return ; + } + return { response }; }