fix: address react-hooks lint warnings on #1680 fix-PR

- handleSubmit useCallback: add missing itemType dep
- details useMemo: keep optimisticTick (rerender signal for cold-open
  ref reads) with eslint-disable + why-comment
This commit is contained in:
nwparker
2026-05-10 21:07:05 -07:00
parent 2c69b9e7b1
commit 1fbedc3ee0
@@ -2320,7 +2320,7 @@ function GHCommentComposer({
} finally {
setSubmitting(false)
}
}, [autoGrow, body, repoPath, issueNumber, onCommentAdded])
}, [autoGrow, body, repoPath, issueNumber, itemType, onCommentAdded])
const handleKeyDown = useCallback(
(e: React.KeyboardEvent) => {
@@ -2555,6 +2555,12 @@ export default function GitHubItemDialog({
return cachedDetails
}
return { ...cachedDetails, comments: [...cachedDetails.comments, ...missing] }
// Why: optimisticTick is the rerender signal for cold-open writes — the
// memo reads optimisticCommentsRef.current (a ref, no subscription), so
// bumping the tick is what forces this memo to re-run. The lint flags it
// as "unnecessary" because it's not referenced in the body, but removing
// it would silently break the cold-open optimistic-shell path.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [cachedEntry, workItem, optimisticTick])
const loading = !!cachedEntry?.pending && !cachedEntry?.details