From 2fb98156f60410deb5d2870389964724cbea5217 Mon Sep 17 00:00:00 2001 From: Joel Jeremy Marquez Date: Thu, 5 Feb 2026 09:05:23 -0800 Subject: [PATCH] Fix react/exhaustive-deps in PayeeTable (#6863) * Fix react/exhaustive-deps in Modals * Fix react/exhaustive-deps in PayeeTable * Add release notes for PR #6863 * Change category and fix dependency management in PayeeTable Updated category from 'Enhancements' to 'Maintenance' and fixed dependency management in PayeeTable. --------- Co-authored-by: github-actions[bot] --- .../desktop-client/src/components/payees/PayeeTable.tsx | 8 ++++++-- upcoming-release-notes/6863.md | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 upcoming-release-notes/6863.md diff --git a/packages/desktop-client/src/components/payees/PayeeTable.tsx b/packages/desktop-client/src/components/payees/PayeeTable.tsx index 32646798b0..9a28ec8a4e 100644 --- a/packages/desktop-client/src/components/payees/PayeeTable.tsx +++ b/packages/desktop-client/src/components/payees/PayeeTable.tsx @@ -2,6 +2,7 @@ import { forwardRef, useCallback, + useEffectEvent, useLayoutEffect, useState, type ComponentProps, @@ -41,12 +42,15 @@ export const PayeeTable = forwardRef< const [hovered, setHovered] = useState(null); const selectedItems = useSelectedItems(); - useLayoutEffect(() => { + const onScrollToSelected = useEffectEvent(() => { const firstSelected = [...selectedItems][0] as string; if (typeof ref !== 'function') { ref.current.scrollTo(firstSelected, 'center'); } - // oxlint-disable-next-line react-hooks/exhaustive-deps + }); + + useLayoutEffect(() => { + onScrollToSelected(); }, []); const onHover = useCallback(id => { diff --git a/upcoming-release-notes/6863.md b/upcoming-release-notes/6863.md new file mode 100644 index 0000000000..341c661176 --- /dev/null +++ b/upcoming-release-notes/6863.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [joel-jeremy] +--- + +Fix react-hooks/exhaustive-deps in in PayeeTable