mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-22 00:13:45 -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 {
|
import {
|
||||||
forwardRef,
|
forwardRef,
|
||||||
useCallback,
|
useCallback,
|
||||||
|
useEffectEvent,
|
||||||
useLayoutEffect,
|
useLayoutEffect,
|
||||||
useState,
|
useState,
|
||||||
type ComponentProps,
|
type ComponentProps,
|
||||||
@@ -41,12 +42,15 @@ export const PayeeTable = forwardRef<
|
|||||||
const [hovered, setHovered] = useState(null);
|
const [hovered, setHovered] = useState(null);
|
||||||
const selectedItems = useSelectedItems();
|
const selectedItems = useSelectedItems();
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
const onScrollToSelected = useEffectEvent(() => {
|
||||||
const firstSelected = [...selectedItems][0] as string;
|
const firstSelected = [...selectedItems][0] as string;
|
||||||
if (typeof ref !== 'function') {
|
if (typeof ref !== 'function') {
|
||||||
ref.current.scrollTo(firstSelected, 'center');
|
ref.current.scrollTo(firstSelected, 'center');
|
||||||
}
|
}
|
||||||
// oxlint-disable-next-line react-hooks/exhaustive-deps
|
});
|
||||||
|
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
onScrollToSelected();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onHover = useCallback(id => {
|
const onHover = useCallback(id => {
|
||||||
|
|||||||
6
upcoming-release-notes/6863.md
Normal file
6
upcoming-release-notes/6863.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
category: Maintenance
|
||||||
|
authors: [joel-jeremy]
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix react-hooks/exhaustive-deps in in PayeeTable
|
||||||
Reference in New Issue
Block a user