From f805acbcef6f5c8593696e4fa3dc0e55fd855be3 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Tue, 9 Apr 2024 19:18:43 +0530 Subject: [PATCH] chore: workspace invite loader improvement (#4152) --- web/layouts/auth-layout/workspace-wrapper.tsx | 4 ++-- web/pages/invitations/index.tsx | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/web/layouts/auth-layout/workspace-wrapper.tsx b/web/layouts/auth-layout/workspace-wrapper.tsx index 8787a36dc..8b40597b2 100644 --- a/web/layouts/auth-layout/workspace-wrapper.tsx +++ b/web/layouts/auth-layout/workspace-wrapper.tsx @@ -32,7 +32,7 @@ export const WorkspaceAuthWrapper: FC = observer((props) const { workspace: { fetchWorkspaceMembers }, } = useMember(); - const { workspaces, loader } = useWorkspace(); + const { workspaces } = useWorkspace(); const { isMobile } = usePlatformOS(); const planeLogo = resolvedTheme === "dark" ? PlaneWhiteLogo : PlaneBlackLogo; @@ -84,7 +84,7 @@ export const WorkspaceAuthWrapper: FC = observer((props) }; // if list of workspaces are not there then we have to render the spinner - if (allWorkspaces === undefined || loader) { + if (allWorkspaces === undefined) { return (
diff --git a/web/pages/invitations/index.tsx b/web/pages/invitations/index.tsx index 5d22ab587..b9b24694b 100644 --- a/web/pages/invitations/index.tsx +++ b/web/pages/invitations/index.tsx @@ -15,7 +15,7 @@ import { MEMBER_ACCEPTED } from "@/constants/event-tracker"; import { ROLE } from "@/constants/workspace"; import { truncateText } from "@/helpers/string.helper"; import { getUserRole } from "@/helpers/user.helper"; -import { useEventTracker, useUser } from "@/hooks/store"; +import { useEventTracker, useUser, useWorkspace } from "@/hooks/store"; import { UserAuthWrapper } from "@/layouts/auth-layout"; import DefaultLayout from "@/layouts/default-layout"; import { NextPageWithLayout } from "@/lib/types"; @@ -43,6 +43,7 @@ const UserInvitationsPage: NextPageWithLayout = observer(() => { // store hooks const { captureEvent, joinWorkspaceMetricGroup } = useEventTracker(); const { currentUser, currentUserSettings } = useUser(); + const { fetchWorkspaces } = useWorkspace(); // router const router = useRouter(); // next-themes @@ -96,7 +97,9 @@ const UserInvitationsPage: NextPageWithLayout = observer(() => { .updateUser({ last_workspace_id: redirectWorkspace?.id }) .then(() => { setIsJoiningWorkspaces(false); - router.push(`/${redirectWorkspace?.slug}`); + fetchWorkspaces().then(() => { + router.push(`/${redirectWorkspace?.slug}`); + }); }) .catch(() => { setToast({