From 211ba45869a24beda4a86bddcf4118cfad7fc9ff Mon Sep 17 00:00:00 2001 From: Udit Date: Sat, 7 Sep 2024 15:47:48 +0530 Subject: [PATCH 1/2] added optional chaining due to strict null check --- apps/platform/src/app/(main)/page.tsx | 9 ++++++--- .../src/app/(main)/project/[project]/@secret/page.tsx | 2 +- .../src/app/(main)/project/[project]/layout.tsx | 2 +- apps/platform/src/app/auth/invite/page.tsx | 6 +++--- apps/platform/src/components/shared/navbar/index.tsx | 2 +- .../platform/src/components/teams/teamTable/index.tsx | 2 +- apps/platform/src/components/ui/line-tab.tsx | 2 +- apps/platform/src/env.ts | 2 +- apps/platform/src/lib/workspace-storage.ts | 11 ++++++++--- apps/platform/src/middleware.ts | 2 +- package.json | 4 ++-- 11 files changed, 26 insertions(+), 18 deletions(-) diff --git a/apps/platform/src/app/(main)/page.tsx b/apps/platform/src/app/(main)/page.tsx index 94c3515b..58539509 100644 --- a/apps/platform/src/app/(main)/page.tsx +++ b/apps/platform/src/app/(main)/page.tsx @@ -56,9 +56,12 @@ export default function Index(): JSX.Element { const router = useRouter() - const currentWorkspace = JSON.parse( - localStorage.getItem('currentWorkspace') ?? '{}' - ) as Workspace + const currentWorkspace = + typeof localStorage !== 'undefined' + ? (JSON.parse( + localStorage.getItem('currentWorkspace') ?? '{}' + ) as Workspace) + : (JSON.parse(`{}`) as Workspace) useEffect(() => { Projects.getProjectsbyWorkspaceID(currentWorkspace.id) diff --git a/apps/platform/src/app/(main)/project/[project]/@secret/page.tsx b/apps/platform/src/app/(main)/project/[project]/@secret/page.tsx index fca52e8e..8919cbf7 100644 --- a/apps/platform/src/app/(main)/project/[project]/@secret/page.tsx +++ b/apps/platform/src/app/(main)/project/[project]/@secret/page.tsx @@ -53,7 +53,7 @@ function SecretPage(): React.JSX.Element { collapsible type="single" > - {allSecrets.map((secret) => { + {allSecrets?.map((secret) => { return (
-
{currentProject.name}
+
{currentProject?.name}