From cc069b61aa725a416cec994b9f6378f6874012c3 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Fri, 8 Mar 2024 17:57:48 +0530 Subject: [PATCH] fix: empty state error handling added and page empty state key updated (#3915) --- web/components/empty-state/empty-state.tsx | 4 ++++ web/constants/empty-state.ts | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/web/components/empty-state/empty-state.tsx b/web/components/empty-state/empty-state.tsx index 9ef216068..a9ff4decd 100644 --- a/web/components/empty-state/empty-state.tsx +++ b/web/components/empty-state/empty-state.tsx @@ -39,6 +39,10 @@ export const EmptyState: React.FC = (props) => { } = useUser(); // theme const { resolvedTheme } = useTheme(); + + // if empty state type is not found + if (!EMPTY_STATE_DETAILS[type]) return null; + // current empty state details const { key, title, description, path, primaryButton, secondaryButton, accessType, access } = EMPTY_STATE_DETAILS[type]; diff --git a/web/constants/empty-state.ts b/web/constants/empty-state.ts index 38f334b20..3e72ef5a6 100644 --- a/web/constants/empty-state.ts +++ b/web/constants/empty-state.ts @@ -69,7 +69,7 @@ export enum EmptyStateType { PROJECT_VIEW = "project-view", PROJECT_PAGE = "project-page", PROJECT_PAGE_ALL = "project-page-all", - PROJECT_PAGE_FAVORITE = "project-page-favorite", + PROJECT_PAGE_FAVORITE = "project-page-favorites", PROJECT_PAGE_PRIVATE = "project-page-private", PROJECT_PAGE_SHARED = "project-page-shared", PROJECT_PAGE_ARCHIVED = "project-page-archived", @@ -475,8 +475,8 @@ const emptyStateDetails = { "Pages help you organise your thoughts to create wikis, discussions or even document heated takes for your project. Use it wisely!", path: "/empty-state/pages/all", }, - "project-page-favorite": { - key: "project-page-favorite", + "project-page-favorites": { + key: "project-page-favorites", title: "No favorite pages yet", description: "Favorites for quick access? mark them and find them right here.", path: "/empty-state/pages/favorites",