Skip to content

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

improvement:

Scott Wilson3870d24793b9
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/AuditLogDetailsSheet.tsx b/frontend/src/pages/organization/AuditLogsPage/components/AuditLogDetailsSheet.tsx
index 89f7472fcf..b3c879f2c2 100644
--- a/frontend/src/pages/organization/AuditLogsPage/components/AuditLogDetailsSheet.tsx
+++ b/frontend/src/pages/organization/AuditLogsPage/components/AuditLogDetailsSheet.tsx
@@ -1,3 +1,5 @@
+import { useState } from "react";
+
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@app/components/v3";
import { formatDateTime, Timezone } from "@app/helpers/datetime";
import { AuditLog } from "@app/hooks/api/auditLogs/types";
@@ -12,20 +14,30 @@ type Props = {
};
export const AuditLogDetailsSheet = ({ isOpen, onOpenChange, auditLog, timezone }: Props) => {
- if (!auditLog) return null;
+ // Closing the sheet clears the popup data in the same render `isOpen` flips to false. Retain the
+ // last log so its content stays rendered through the Sheet's exit animation rather than the Sheet
+ // unmounting instantly and skipping the close transition.
+ const [displayedLog, setDisplayedLog] = useState(auditLog);
+ if (auditLog && auditLog.id !== displayedLog?.id) {
+ setDisplayedLog(auditLog);
+ }
return (
<Sheet open={isOpen} onOpenChange={onOpenChange}>
<SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-2xl">
- <SheetHeader className="border-b">
- <SheetTitle className="font-mono">{auditLog.event.type}</SheetTitle>
- <SheetDescription>
- {formatDateTime({ timestamp: auditLog.createdAt, timezone })}
- </SheetDescription>
- </SheetHeader>
- <div className="min-h-0 flex-1 p-4">
- <JsonHighlight value={auditLog} className="h-full" />
- </div>
+ {displayedLog && (
+ <>
+ <SheetHeader className="border-b">
+ <SheetTitle className="font-mono">{displayedLog.event.type}</SheetTitle>
+ <SheetDescription>
+ {formatDateTime({ timestamp: displayedLog.createdAt, timezone })}
+ </SheetDescription>
+ </SheetHeader>
+ <div className="min-h-0 flex-1 p-4">
+ <JsonHighlight value={displayedLog} className="h-full" />
+ </div>
+ </>
+ )}
</SheetContent>
</Sheet>
);
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/LogsTable.tsx b/frontend/src/pages/organization/AuditLogsPage/components/LogsTable.tsx
index 39e284ac14..bfd420897b 100644
--- a/frontend/src/pages/organization/AuditLogsPage/components/LogsTable.tsx
+++ b/frontend/src/pages/organization/AuditLogsPage/components/LogsTable.tsx
@@ -123,16 +123,18 @@ export const LogsTable = ({ filter, refetchInterval, timezone }: Props) => {
))}
</TableBody>
</Table>
- <Button
- className="mt-4"
- isFullWidth
- variant={scopeVariant}
- isPending={isFetchingNextPage}
- isDisabled={isFetchingNextPage || !hasNextPage}
- onClick={() => fetchNextPage()}
- >
- {hasNextPage ? `Load More (${totalLoaded} loaded)` : `End of logs (${totalLoaded} total)`}
- </Button>
+ {!isPending && (
+ <Button
+ className="mt-4"
+ isFullWidth
+ variant={scopeVariant}
+ isPending={isFetchingNextPage}
+ isDisabled={isFetchingNextPage || !hasNextPage}
+ onClick={() => fetchNextPage()}
+ >
+ {hasNextPage ? `Load More (${totalLoaded} loaded)` : `End of logs (${totalLoaded} total)`}
+ </Button>
+ )}
<AuditLogDetailsSheet
isOpen={popUp.logDetails.isOpen}
onOpenChange={(open) => handlePopUpToggle("logDetails", open)}