mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-21 15:36:50 -05:00
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] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
2f86bafd1f
commit
2fb98156f6
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user