fix: refetch endpoints on backend startup (improvement for devs) (#7208)
🔧 (AppInitPage/index.tsx): refactor useGetConfig hook to only fetch when isFetched is true for better performance 🔧 (AppInitPage/index.tsx): add refetch functionality for useGetAutoLogin and useGetBasicExamplesQuery hooks to update data when isConfigFetched is true
This commit is contained in:
parent
166b0a07da
commit
3faf4fc7c8
1 changed files with 10 additions and 4 deletions
|
|
@ -19,19 +19,25 @@ export function AppInitPage() {
|
||||||
|
|
||||||
const { isFetched: isLoaded } = useCustomPrimaryLoading();
|
const { isFetched: isLoaded } = useCustomPrimaryLoading();
|
||||||
|
|
||||||
const { isFetched } = useGetAutoLogin({ enabled: isLoaded });
|
const { isFetched, refetch } = useGetAutoLogin({ enabled: isLoaded });
|
||||||
useGetVersionQuery({ enabled: isFetched });
|
useGetVersionQuery({ enabled: isFetched });
|
||||||
useGetConfig({ enabled: isFetched });
|
const { isFetched: isConfigFetched } = useGetConfig({ enabled: isFetched });
|
||||||
useGetGlobalVariables({ enabled: isFetched });
|
useGetGlobalVariables({ enabled: isFetched });
|
||||||
useGetTagsQuery({ enabled: isFetched });
|
useGetTagsQuery({ enabled: isFetched });
|
||||||
useGetFoldersQuery({ enabled: isFetched });
|
useGetFoldersQuery({ enabled: isFetched });
|
||||||
const { isFetched: isExamplesFetched } = useGetBasicExamplesQuery();
|
const { isFetched: isExamplesFetched, refetch: refetchExamples } =
|
||||||
|
useGetBasicExamplesQuery();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isFetched) {
|
if (isFetched) {
|
||||||
refreshStars();
|
refreshStars();
|
||||||
}
|
}
|
||||||
}, [isFetched]);
|
|
||||||
|
if (isConfigFetched) {
|
||||||
|
refetch();
|
||||||
|
refetchExamples();
|
||||||
|
}
|
||||||
|
}, [isFetched, isConfigFetched]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
//need parent component with width and height
|
//need parent component with width and height
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue