mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-09 06:03:01 -05:00
Fix react/exhaustive-deps in Modals (#6862)
* Fix react/exhaustive-deps in Modals * Add release notes for PR #6862 --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
7f6f4d5def
commit
2f86bafd1f
@@ -1,5 +1,5 @@
|
||||
// @ts-strict-ignore
|
||||
import React, { Fragment, useEffect } from 'react';
|
||||
import React, { Fragment, useEffect, useEffectEvent } from 'react';
|
||||
import { useLocation } from 'react-router';
|
||||
|
||||
import { send } from 'loot-core/platform/client/fetch';
|
||||
@@ -89,12 +89,15 @@ export function Modals() {
|
||||
const { modalStack } = useModalState();
|
||||
const [budgetId] = useMetadataPref('id');
|
||||
|
||||
useEffect(() => {
|
||||
const onCloseModal = useEffectEvent(() => {
|
||||
if (modalStack.length > 0) {
|
||||
dispatch(closeModal());
|
||||
}
|
||||
// oxlint-disable-next-line react/exhaustive-deps
|
||||
}, [dispatch, location]);
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
onCloseModal();
|
||||
}, [location]);
|
||||
|
||||
const modals = modalStack
|
||||
.map((modal, idx) => {
|
||||
|
||||
6
upcoming-release-notes/6862.md
Normal file
6
upcoming-release-notes/6862.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Maintenance
|
||||
authors: [joel-jeremy]
|
||||
---
|
||||
|
||||
Refactor modal closing behavior to improve code clarity and eliminate eslint disable patterns.
|
||||
Reference in New Issue
Block a user