diff --git a/src/renderer/hooks/useAttachments.ts b/src/renderer/hooks/useAttachments.ts index 5816cce7..25a83497 100644 --- a/src/renderer/hooks/useAttachments.ts +++ b/src/renderer/hooks/useAttachments.ts @@ -61,6 +61,7 @@ export function useAttachments(options?: UseAttachmentsOptions): UseAttachmentsR // eslint-disable-next-line react-hooks/refs -- synchronous ref sync during render is intentional to avoid stale key in callbacks keyRef.current = persistenceKey; const onUnsupportedRef = useRef(options?.onUnsupportedFiles); + // eslint-disable-next-line react-hooks/refs -- synchronous ref sync during render is intentional to avoid stale callback in handlers onUnsupportedRef.current = options?.onUnsupportedFiles; // Sync ref with state diff --git a/src/renderer/hooks/useMarkCommentsRead.ts b/src/renderer/hooks/useMarkCommentsRead.ts index 12a6d797..07fcabe6 100644 --- a/src/renderer/hooks/useMarkCommentsRead.ts +++ b/src/renderer/hooks/useMarkCommentsRead.ts @@ -1,4 +1,4 @@ -import { useRef } from 'react'; +import { useCallback, useRef } from 'react'; /** * Provides a stable ref callback for the comments container. @@ -19,9 +19,9 @@ export function useMarkCommentsRead( const nodeRef = useRef(null); // Stable ref callback (no dependencies — just stores the node) - const refCallback = useRef((node: HTMLElement | null) => { + const refCallback = useCallback((node: HTMLElement | null) => { nodeRef.current = node; - }).current; + }, []); return refCallback; }