mirror of https://github.com/buster-so/buster.git
dashboard loader state update
This commit is contained in:
parent
24d785616c
commit
6596d99a35
|
@ -1,12 +1,8 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import type { BusterDashboard, BusterDashboardResponse } from '@/api/asset_interfaces/dashboard';
|
import type { BusterDashboard } from '@/api/asset_interfaces/dashboard';
|
||||||
|
import { useMount } from '@/hooks';
|
||||||
import { create } from 'zustand';
|
import { create } from 'zustand';
|
||||||
import { compareObjectsByKeys } from '@/lib/objects';
|
|
||||||
import { useGetDashboard } from '@/api/buster_rest/dashboards';
|
|
||||||
import { useMemoizedFn, useMount } from '@/hooks';
|
|
||||||
import { useQueryClient } from '@tanstack/react-query';
|
|
||||||
import { dashboardQueryKeys } from '@/api/query_keys/dashboard';
|
|
||||||
|
|
||||||
type OriginalDashboardStore = {
|
type OriginalDashboardStore = {
|
||||||
originalDashboards: Record<string, BusterDashboard>;
|
originalDashboards: Record<string, BusterDashboard>;
|
||||||
|
|
|
@ -58,7 +58,11 @@ export const useGetAsset = (props: UseGetAssetProps): UseGetAssetReturn<typeof p
|
||||||
);
|
);
|
||||||
|
|
||||||
//dashboard
|
//dashboard
|
||||||
const { isFetched: isFetchedDashboard, error: errorDashboard } = useGetDashboard(
|
const {
|
||||||
|
isFetched: isFetchedDashboard,
|
||||||
|
error: errorDashboard,
|
||||||
|
isError: isErrorDashboard
|
||||||
|
} = useGetDashboard(
|
||||||
{
|
{
|
||||||
id: props.type === 'dashboard' ? props.assetId : undefined
|
id: props.type === 'dashboard' ? props.assetId : undefined
|
||||||
},
|
},
|
||||||
|
@ -88,7 +92,7 @@ export const useGetAsset = (props: UseGetAssetProps): UseGetAssetReturn<typeof p
|
||||||
hasAccess,
|
hasAccess,
|
||||||
passwordRequired,
|
passwordRequired,
|
||||||
isPublic,
|
isPublic,
|
||||||
showLoader: isFetchedDashboard || !!errorDashboard
|
showLoader: !isFetchedDashboard || isErrorDashboard
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue