feat: resolved loading screen frozen on no environment and project switch causes forEach undefined error

This commit is contained in:
=
2024-11-26 20:27:30 +05:30
parent 3b0c48052b
commit 5bcf07b32b
2 changed files with 6 additions and 3 deletions
+4 -1
View File
@@ -560,8 +560,11 @@ export const AppLayout = ({ children }: LayoutProps) => {
value={currentWorkspace?.id} value={currentWorkspace?.id}
className="w-full bg-mineshaft-600 py-2.5 font-medium [&>*:first-child]:truncate" className="w-full bg-mineshaft-600 py-2.5 font-medium [&>*:first-child]:truncate"
onValueChange={(value) => { onValueChange={(value) => {
router.push(`/project/${value}/secrets/overview`);
localStorage.setItem("projectData.id", value); localStorage.setItem("projectData.id", value);
// this is not using react query because react query in overview is throwing error when envs are not exact same count
// to reproduce change this back to router.push and switch between two projects with different env count
// look into this on dashboard revamp
window.location.assign(`/project/${value}/secrets/overview`);
}} }}
position="popper" position="popper"
dropdownContainerClassName="text-bunker-200 bg-mineshaft-800 border border-mineshaft-600 z-50 max-h-96 border-gray-700" dropdownContainerClassName="text-bunker-200 bg-mineshaft-800 border border-mineshaft-600 z-50 max-h-96 border-gray-700"
@@ -186,7 +186,7 @@ export const SecretOverviewPage = () => {
useGetImportedSecretsAllEnvs({ useGetImportedSecretsAllEnvs({
projectId: workspaceId, projectId: workspaceId,
path: secretPath, path: secretPath,
environments: userAvailableEnvs.map(({ slug }) => slug) environments: (userAvailableEnvs || []).map(({ slug }) => slug)
}); });
const { isLoading: isOverviewLoading, data: overview } = useGetProjectSecretsOverview( const { isLoading: isOverviewLoading, data: overview } = useGetProjectSecretsOverview(
@@ -618,7 +618,7 @@ export const SecretOverviewPage = () => {
} }
}, [router.query.search]); }, [router.query.search]);
if (isWorkspaceLoading || (isProjectV3 && isOverviewLoading)) { if (isWorkspaceLoading || (isProjectV3 && visibleEnvs.length > 0 && isOverviewLoading)) {
return ( return (
<div className="container mx-auto flex h-screen w-full items-center justify-center px-8 text-mineshaft-50 dark:[color-scheme:dark]"> <div className="container mx-auto flex h-screen w-full items-center justify-center px-8 text-mineshaft-50 dark:[color-scheme:dark]">
<img <img