fix: do not render page while examples are loading (#4768)
* Added check if examples load before loading all pages * [autofix.ci] apply automated fixes --------- Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
08849b6bab
commit
f440552ee9
2 changed files with 11 additions and 5 deletions
|
|
@ -26,6 +26,7 @@ export const useGetBasicExamplesQuery: useQueryFunctionType<
|
||||||
|
|
||||||
const queryResult = query(["useGetBasicExamplesQuery"], responseFn, {
|
const queryResult = query(["useGetBasicExamplesQuery"], responseFn, {
|
||||||
...options,
|
...options,
|
||||||
|
retry: 3,
|
||||||
});
|
});
|
||||||
|
|
||||||
return queryResult;
|
return queryResult;
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,13 @@ export function AppInitPage() {
|
||||||
useGetConfig({ enabled: isFetched });
|
useGetConfig({ enabled: isFetched });
|
||||||
const { isFetched: typesLoaded } = useGetTypes({ enabled: isFetched });
|
const { isFetched: typesLoaded } = useGetTypes({ enabled: isFetched });
|
||||||
useGetGlobalVariables({ enabled: typesLoaded });
|
useGetGlobalVariables({ enabled: typesLoaded });
|
||||||
useGetBasicExamplesQuery({ enabled: typesLoaded });
|
|
||||||
useGetTagsQuery({ enabled: typesLoaded });
|
useGetTagsQuery({ enabled: typesLoaded });
|
||||||
|
useGetFoldersQuery({
|
||||||
useGetFoldersQuery({ enabled: typesLoaded });
|
enabled: typesLoaded,
|
||||||
|
});
|
||||||
|
const { isFetched: isExamplesFetched } = useGetBasicExamplesQuery({
|
||||||
|
enabled: typesLoaded,
|
||||||
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isFetched) {
|
if (isFetched) {
|
||||||
|
|
@ -49,11 +52,13 @@ export function AppInitPage() {
|
||||||
//need parent component with width and height
|
//need parent component with width and height
|
||||||
<>
|
<>
|
||||||
{isLoaded ? (
|
{isLoaded ? (
|
||||||
(isLoading || !isFetched || !typesLoaded) && <LoadingPage overlay />
|
(isLoading || !isFetched || !isExamplesFetched || !typesLoaded) && (
|
||||||
|
<LoadingPage overlay />
|
||||||
|
)
|
||||||
) : (
|
) : (
|
||||||
<CustomLoadingPage />
|
<CustomLoadingPage />
|
||||||
)}
|
)}
|
||||||
{isFetched && typesLoaded && <Outlet />}
|
{isFetched && isExamplesFetched && typesLoaded && <Outlet />}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue