Skip to content
Snippets Groups Projects
Unverified Commit 85b053b7 authored by Alexander Polyankin's avatar Alexander Polyankin Committed by GitHub
Browse files

Load metadata before queries (#43354)

parent b55e141f
No related branches found
No related tags found
No related merge requests found
......@@ -19,8 +19,8 @@ export const revertToRevision = createThunkAction(
}),
);
await Promise.all([
dispatch(fetchDashboardCardData({ reload: false, clearCache: true })),
dispatch(fetchDashboardCardMetadata()),
dispatch(fetchDashboardCardData({ reload: false, clearCache: true })),
]);
};
},
......
......@@ -330,8 +330,8 @@ function DashboardInner(props: DashboardProps) {
);
if (hasDashboardLoaded) {
fetchDashboardCardData({ reload: false, clearCache: true });
fetchDashboardCardMetadata();
fetchDashboardCardData({ reload: false, clearCache: true });
} else if (hasTabChanged || hasParameterValueChanged) {
fetchDashboardCardData();
}
......
......@@ -72,11 +72,11 @@ export const DashboardData = ComposedComponent =>
try {
await Promise.all([
fetchDashboardCardMetadata(),
fetchDashboardCardData({
reload: false,
clearCache: !isNavigatingBackToDashboard,
}),
fetchDashboardCardMetadata(),
]);
} catch (error) {
console.error(error);
......
......@@ -28,6 +28,7 @@ export const useRefreshDashboard = ({
options: { preserveParameters: true },
}),
);
dispatch(fetchDashboardCardMetadata());
dispatch(
fetchDashboardCardData({
isRefreshing: true,
......@@ -35,7 +36,6 @@ export const useRefreshDashboard = ({
clearCache: false,
}),
);
dispatch(fetchDashboardCardMetadata());
}
}, [dashboardId, dispatch, parameterQueryParams]);
......
......@@ -126,14 +126,10 @@ class PublicDashboardInner extends Component<PublicDashboardProps> {
}
try {
const requests = [];
await fetchDashboardCardMetadata();
if (this.props.dashboard?.tabs?.length === 0) {
requests.push(
fetchDashboardCardData({ reload: false, clearCache: true }),
);
await fetchDashboardCardData({ reload: false, clearCache: true });
}
requests.push(fetchDashboardCardMetadata());
await Promise.all(requests);
} catch (error) {
console.error(error);
setErrorPage(error);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment