feat: keep mailbox health and usage unknown until Cloud and account status checks finish with refresh and incomplete-data regressions

This commit is contained in:
Matthew Meszaros
2026-10-09 16:27:20 +00:00
committed by Devin AI
parent 2cf19ebedf
commit cdb102ca56
5 changed files with 115 additions and 26 deletions
+7 -3
View File
@@ -3,7 +3,7 @@
// warms. Members who manage mailboxes see the link and use it for their own
// mailboxes (`manageable`); linking it is the instance administrator's.
import { useMemo } from "react";
import { useCallback, useMemo } from "react";
import useAuthConfig from "@/lib/api/hooks/auth/useAuthConfig";
import { useInstanceAdmin, usePermission } from "@/hooks/usePermission";
import { useCloudLinkMailboxes, useCloudLinkStatus } from "@/lib/api/hooks/app/cloudlink/useCloudLink";
@@ -27,6 +27,7 @@ export default function useCloudPool() {
const enrolledCount = useMemo(() => (mailboxes.data ?? []).filter((r) => r.enrolled).length, [mailboxes.data]);
const plan: PoolLinkPlan | undefined = status.data?.info?.plan;
const rowFor = useCallback((id: string) => byId.get(id), [byId]);
return {
selfHosted,
@@ -37,8 +38,11 @@ export default function useCloudPool() {
orgName: status.data?.link?.organization_name ?? "",
plan,
enrolledCount,
rowFor: (id: string) => byId.get(id),
rowFor,
isEnrolled: (id: string) => byId.get(id)?.enrolled === true,
loading: manageable && (status.isLoading || (connected && mailboxes.isLoading)),
loading: manageable && (status.isPending || (connected && mailboxes.isPending)),
refreshing: manageable && (status.isFetching || (connected && mailboxes.isFetching)),
unavailable: manageable && (status.isError || (connected && mailboxes.isError)),
observedAt: connected ? mailboxes.dataUpdatedAt : 0,
};
}