refactor: updated loading state in gridgraphlayout (#3313)

Co-authored-by: Palash Gupta <palashgdev@gmail.com>
This commit is contained in:
Rajat Dabade 2023-08-11 15:17:32 +05:30 committed by GitHub
parent 86b725757c
commit 1fc0461c0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,7 +101,7 @@ function GridCardGraph({
const isEmptyLayout = widget?.id === 'empty' || isEmpty(widget);
if (queryResponse.isRefetching) {
if (queryResponse.isRefetching || queryResponse.isLoading) {
return <Spinner height="20vh" tip="Loading..." />;
}
@ -127,10 +127,9 @@ function GridCardGraph({
);
}
if (queryResponse.status === 'loading' || queryResponse.status === 'idle') {
if (!isEmpty(widget) && prevChartDataSetRef?.labels) {
return (
<span ref={graphRef}>
{!isEmpty(widget) && prevChartDataSetRef?.labels ? (
<WidgetGraphComponent
enableModel={false}
enableWidgetHeader
@ -145,9 +144,6 @@ function GridCardGraph({
headerMenuList={headerMenuList}
onClickHandler={onClickHandler}
/>
) : (
<Spinner height="20vh" tip="Loading..." />
)}
</span>
);
}