Skip to content

Commit 3d37951

Browse files
committed
fix(organizations): refetch the summary role on mount
1 parent 898c815 commit 3d37951

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎apps/sim/app/workspace/[workspaceId]/settings/components/team-management/team-management.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export function TeamManagement({
9999
const rosterRole = roster?.members.find((member) => member.userId === session?.user?.id)?.role
100100
const organizationSummary = useOrganizationSummary(organizationId, {
101101
enabled: rosterError !== null,
102+
refetchOnMount: 'always',
102103
})
103104
// Fetched on this mount, so the identity-scoped role belongs to the current session.
104105
const summaryRole = organizationSummary.isFetchedAfterMount

‎apps/sim/hooks/queries/organization.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,13 @@ export const ORGANIZATION_REMOVAL_IMPACT_STALE_TIME = 0
4949
export { organizationKeys }
5050

5151
/** Revalidates organization membership and chat policy through the shared authorized read. */
52-
export function useOrganizationSummary(organizationId: string, options?: { enabled?: boolean }) {
52+
export function useOrganizationSummary(
53+
organizationId: string,
54+
options?: { enabled?: boolean; refetchOnMount?: 'always' }
55+
) {
5356
return useQuery({
5457
enabled: options?.enabled ?? true,
58+
refetchOnMount: options?.refetchOnMount ?? true,
5559
queryKey: organizationKeys.summary(organizationId),
5660
queryFn: ({ signal }) =>
5761
requestJson(getOrganizationContract, {

0 commit comments

Comments
 (0)