Skip to content

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

fix(pam): fix scroll ref not resetting on re-click and toast spam on load more

bernie-g728bb49d75ae
diff --git a/frontend/src/pages/pam/PamSessionsByIDPage/components/CommandLogView.tsx b/frontend/src/pages/pam/PamSessionsByIDPage/components/CommandLogView.tsx
index 91abe219e5..3c3bc924af 100644
--- a/frontend/src/pages/pam/PamSessionsByIDPage/components/CommandLogView.tsx
+++ b/frontend/src/pages/pam/PamSessionsByIDPage/components/CommandLogView.tsx
@@ -21,10 +21,14 @@ export const CommandLogView = ({ logs, scrollToLogIndex }: Props) => {
const handledScrollIndexRef = useRef<number | undefined>(undefined);
useEffect(() => {
- if (scrollToLogIndex == null) return;
+ if (scrollToLogIndex == null) {
+ handledScrollIndexRef.current = undefined;
+ return;
+ }
if (scrollToLogIndex === handledScrollIndexRef.current) return;
const target = logs[scrollToLogIndex - 1];
if (!target) {
+ handledScrollIndexRef.current = scrollToLogIndex;
createNotification({
type: "info",
text: "Log entry not yet loaded. Load more logs to jump to this entry."