A local-first personal finance app
[Address suppressed ESLint errors] Fix exhaustive deps errors in App.tsx (#4124)
Joel Jeremy Marquezc34765356624
diff --git a/eslint.config.mjs b/eslint.config.mjsindex 0d02846700..e5ab04e162 100644--- a/eslint.config.mjs+++ b/eslint.config.mjs@@ -743,7 +743,6 @@ export default ['packages/desktop-client/src/components/accounts/Account.jsx','packages/desktop-client/src/components/accounts/MobileAccount.jsx','packages/desktop-client/src/components/accounts/MobileAccounts.jsx',- 'packages/desktop-client/src/components/App.tsx','packages/desktop-client/src/components/budget/BudgetCategories.jsx','packages/desktop-client/src/components/budget/BudgetSummaries.tsx','packages/desktop-client/src/components/budget/DynamicBudgetTable.tsx',diff --git a/packages/desktop-client/src/components/App.tsx b/packages/desktop-client/src/components/App.tsxindex fafac79331..a581962667 100644--- a/packages/desktop-client/src/components/App.tsx+++ b/packages/desktop-client/src/components/App.tsx@@ -53,74 +53,78 @@ function AppInner() {const dispatch = useDispatch();const userData = useSelector(state => state.user.data);- const maybeUpdate = async <T,>(cb?: () => T): Promise<T> => {- if (global.Actual.isUpdateReadyForDownload()) {+ useEffect(() => {+ const maybeUpdate = async <T,>(cb?: () => T): Promise<T> => {+ if (global.Actual.isUpdateReadyForDownload()) {+ dispatch(+ setAppState({+ loadingText: t('Downloading and applying update...'),+ }),+ );+ await global.Actual.applyAppUpdate();+ }+ return cb?.();+ };++ async function init() {+ const socketName = await maybeUpdate(() =>+ global.Actual.getServerSocket(),+ );+dispatch(setAppState({- loadingText: t('Downloading and applying update...'),+ loadingText: t(+ 'Initializing the connection to the local database...',+ ),}),);- await global.Actual.applyAppUpdate();- }- return cb?.();- };-- async function init() {- const socketName = await maybeUpdate(() => global.Actual.getServerSocket());-- dispatch(- setAppState({- loadingText: t('Initializing the connection to the local database...'),- }),- );- await initConnection(socketName);-- // Load any global prefs- dispatch(- setAppState({- loadingText: t('Loading global preferences...'),- }),- );- await dispatch(loadGlobalPrefs());-- // Open the last opened budget, if any- dispatch(- setAppState({- loadingText: t('Opening last budget...'),- }),- );- const budgetId = await send('get-last-opened-backup');- if (budgetId) {- await dispatch(loadBudget(budgetId));-- // Check to see if this file has been remotely deleted (but- // don't block on this in case they are offline or something)+ await initConnection(socketName);++ // Load any global prefsdispatch(setAppState({- loadingText: t('Retrieving remote files...'),+ loadingText: t('Loading global preferences...'),}),);+ await dispatch(loadGlobalPrefs());- const files = await send('get-remote-files');- if (files) {- const remoteFile = files.find(f => f.fileId === cloudFileId);- if (remoteFile && remoteFile.deleted) {- dispatch(closeBudget());+ // Open the last opened budget, if any+ dispatch(+ setAppState({+ loadingText: t('Opening last budget...'),+ }),+ );+ const budgetId = await send('get-last-opened-backup');+ if (budgetId) {+ await dispatch(loadBudget(budgetId));++ // Check to see if this file has been remotely deleted (but+ // don't block on this in case they are offline or something)+ dispatch(+ setAppState({+ loadingText: t('Retrieving remote files...'),+ }),+ );++ const files = await send('get-remote-files');+ if (files) {+ const remoteFile = files.find(f => f.fileId === cloudFileId);+ if (remoteFile && remoteFile.deleted) {+ dispatch(closeBudget());+ }}- }- await maybeUpdate();+ await maybeUpdate();+ }}- }- useEffect(() => {async function initAll() {await Promise.all([installPolyfills(), init()]);dispatch(setAppState({ loadingText: null }));}initAll().catch(showErrorBoundary);- }, []);+ }, [cloudFileId, dispatch, showErrorBoundary, t]);useEffect(() => {global.Actual.updateAppMenu(budgetId);@@ -142,7 +146,7 @@ function AppInner() {}),);}- }, [userData, userData?.tokenExpired]);+ }, [addNotification, signOut, t, userData?.tokenExpired]);return budgetId ? <FinancesApp /> : <ManagementApp />;}@@ -187,7 +191,7 @@ export function App() {window.removeEventListener('focus', checkScrollbars);window.removeEventListener('visibilitychange', onVisibilityChange);};- }, [dispatch]);+ }, [dispatch, hiddenScrollbars]);const [theme] = useTheme();diff --git a/upcoming-release-notes/4124.md b/upcoming-release-notes/4124.mdnew file mode 100644index 0000000000..5515cacc28--- /dev/null+++ b/upcoming-release-notes/4124.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [joel-jeremy]+---++[Address suppressed ESLint errors] Fix exhaustive deps errors in App.tsx\ No newline at end of file