chore: workspace invite loader improvement (#4152)

This commit is contained in:
Anmol Singh Bhatia 2024-04-09 19:18:43 +05:30 committed by GitHub
parent 699017014e
commit f805acbcef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View File

@ -32,7 +32,7 @@ export const WorkspaceAuthWrapper: FC<IWorkspaceAuthWrapper> = observer((props)
const { const {
workspace: { fetchWorkspaceMembers }, workspace: { fetchWorkspaceMembers },
} = useMember(); } = useMember();
const { workspaces, loader } = useWorkspace(); const { workspaces } = useWorkspace();
const { isMobile } = usePlatformOS(); const { isMobile } = usePlatformOS();
const planeLogo = resolvedTheme === "dark" ? PlaneWhiteLogo : PlaneBlackLogo; const planeLogo = resolvedTheme === "dark" ? PlaneWhiteLogo : PlaneBlackLogo;
@ -84,7 +84,7 @@ export const WorkspaceAuthWrapper: FC<IWorkspaceAuthWrapper> = observer((props)
}; };
// if list of workspaces are not there then we have to render the spinner // if list of workspaces are not there then we have to render the spinner
if (allWorkspaces === undefined || loader) { if (allWorkspaces === undefined) {
return ( return (
<div className="grid h-screen place-items-center bg-custom-background-100 p-4"> <div className="grid h-screen place-items-center bg-custom-background-100 p-4">
<div className="flex flex-col items-center gap-3 text-center"> <div className="flex flex-col items-center gap-3 text-center">

View File

@ -15,7 +15,7 @@ import { MEMBER_ACCEPTED } from "@/constants/event-tracker";
import { ROLE } from "@/constants/workspace"; import { ROLE } from "@/constants/workspace";
import { truncateText } from "@/helpers/string.helper"; import { truncateText } from "@/helpers/string.helper";
import { getUserRole } from "@/helpers/user.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 { UserAuthWrapper } from "@/layouts/auth-layout";
import DefaultLayout from "@/layouts/default-layout"; import DefaultLayout from "@/layouts/default-layout";
import { NextPageWithLayout } from "@/lib/types"; import { NextPageWithLayout } from "@/lib/types";
@ -43,6 +43,7 @@ const UserInvitationsPage: NextPageWithLayout = observer(() => {
// store hooks // store hooks
const { captureEvent, joinWorkspaceMetricGroup } = useEventTracker(); const { captureEvent, joinWorkspaceMetricGroup } = useEventTracker();
const { currentUser, currentUserSettings } = useUser(); const { currentUser, currentUserSettings } = useUser();
const { fetchWorkspaces } = useWorkspace();
// router // router
const router = useRouter(); const router = useRouter();
// next-themes // next-themes
@ -96,7 +97,9 @@ const UserInvitationsPage: NextPageWithLayout = observer(() => {
.updateUser({ last_workspace_id: redirectWorkspace?.id }) .updateUser({ last_workspace_id: redirectWorkspace?.id })
.then(() => { .then(() => {
setIsJoiningWorkspaces(false); setIsJoiningWorkspaces(false);
fetchWorkspaces().then(() => {
router.push(`/${redirectWorkspace?.slug}`); router.push(`/${redirectWorkspace?.slug}`);
});
}) })
.catch(() => { .catch(() => {
setToast({ setToast({