Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

invalidate query when changing org

Thiago Araujo da Silva9f474b4a5766
diff --git a/frontend/src/pages/middlewares/inject-org-details.tsx b/frontend/src/pages/middlewares/inject-org-details.tsx
index fb3b630cb7..6139149ba8 100644
--- a/frontend/src/pages/middlewares/inject-org-details.tsx
+++ b/frontend/src/pages/middlewares/inject-org-details.tsx
@@ -4,6 +4,7 @@ import SecurityClient from "@app/components/utilities/SecurityClient";
import { SessionStorageKeys } from "@app/const";
import { authKeys, fetchAuthToken, selectOrganization } from "@app/hooks/api/auth/queries";
import { certManagerInstanceKeys } from "@app/hooks/api/certManagerInstance";
+import { identitiesKeys } from "@app/hooks/api/identities/queries";
import { fetchOrganizationById, organizationKeys } from "@app/hooks/api/organization/queries";
import { projectKeys } from "@app/hooks/api/projects";
import { fetchUserOrgPermissions, roleQueryKeys } from "@app/hooks/api/roles/queries";
@@ -46,6 +47,8 @@ export const Route = createFileRoute("/_authenticate/_inject-org-details")({
context.queryClient.removeQueries({ queryKey: projectKeys.getAllUserProjects() });
context.queryClient.removeQueries({ queryKey: subOrganizationsQuery.allKey() });
context.queryClient.removeQueries({ queryKey: certManagerInstanceKeys.all });
+ context.queryClient.removeQueries({ queryKey: identitiesKeys.searchIdentitiesRoot });
+ context.queryClient.removeQueries({ queryKey: identitiesKeys.countIdentitiesRoot });
await context.queryClient.fetchQuery({
queryKey: authKeys.getAuthToken,
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx
index 94bf9c0960..65de536544 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx
@@ -221,8 +221,14 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
<TabsList variant="filled">
<TabsTrigger value="all">All{renderTabCount(allScopeCount)}</TabsTrigger>
<TabsTrigger value="organization">
- <span className="size-1.5 rounded-full bg-org" aria-hidden />
- Organization
+ <span
+ className={twMerge(
+ "size-1.5 rounded-full",
+ isSubOrganization ? "bg-sub-org" : "bg-org"
+ )}
+ aria-hidden
+ />
+ {isSubOrganization ? "Sub-Organization" : "Organization"}
{renderTabCount(orgScopeCount)}
</TabsTrigger>
<TabsTrigger value="project">
@@ -295,7 +301,7 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
<TableHeader>
<TableRow>
<TableHead
- className={twMerge("cursor-pointer", isSubOrganization ? "w-1/5" : "w-1/4")}
+ className="w-1/4 cursor-pointer"
onClick={() => handleSort(OrgIdentityOrderBy.Name)}
>
Name
@@ -309,9 +315,9 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
)}
/>
</TableHead>
- <TableHead className={isSubOrganization ? "w-1/5" : "w-1/4"}>Scope</TableHead>
+ <TableHead className="w-1/4">Scope</TableHead>
<TableHead
- className={twMerge("cursor-pointer", isSubOrganization ? "w-1/5" : "w-1/4")}
+ className="w-1/4 cursor-pointer"
onClick={() => handleSort(OrgIdentityOrderBy.Role)}
>
Role
@@ -326,7 +332,7 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
/>
</TableHead>
<TableHead
- className={twMerge("cursor-pointer", isSubOrganization ? "w-1/5" : "w-1/4")}
+ className="w-1/4 cursor-pointer"
onClick={() => handleSort(OrgIdentityOrderBy.LastLogin)}
>
Last Used
@@ -340,7 +346,6 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
)}
/>
</TableHead>
- {isSubOrganization && <TableHead className="w-1/5">Managed By</TableHead>}
<TableHead className="w-5" />
</TableRow>
</TableHeader>
@@ -360,11 +365,6 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
<TableCell>
<Skeleton className="h-4 w-20" />
</TableCell>
- {isSubOrganization && (
- <TableCell>
- <Skeleton className="h-4 w-full" />
- </TableCell>
- )}
<TableCell>
<Skeleton className="h-4 w-4" />
</TableCell>
@@ -413,11 +413,26 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
>
<TableCell isTruncatable>{name}</TableCell>
<TableCell>
+ {/* eslint-disable-next-line no-nested-ternary */}
{isProjectScoped ? (
<Badge variant="project">
<ProjectIcon />
{project?.name ?? "Project"}
</Badge>
+ ) : isSubOrganization ? (
+ <Badge variant={isSubOrgIdentity ? "sub-org" : "org"}>
+ {isSubOrgIdentity ? (
+ <>
+ <SubOrgIcon />
+ Sub-Organization
+ </>
+ ) : (
+ <>
+ <OrgIcon />
+ Root Organization
+ </>
+ )}
+ </Badge>
) : (
<Badge variant="org">
<OrgIcon />
@@ -550,23 +565,6 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {
<span className="text-sm text-mineshaft-400">{lastUsedLabel}</span>
)}
</TableCell>
- {isSubOrganization && (
- <TableCell>
- <Badge variant={isSubOrgIdentity ? "sub-org" : "org"}>
- {isSubOrgIdentity ? (
- <>
- <SubOrgIcon />
- Sub-Organization
- </>
- ) : (
- <>
- <OrgIcon />
- Root Organization
- </>
- )}
- </Badge>
- </TableCell>
- )}
<TableCell>
<DropdownMenu>
<DropdownMenuTrigger asChild>