-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Address suppressed ESLint errors] Fix exhaustive deps errors in App.tsx #4124
Conversation
joel-jeremy
commented
Jan 10, 2025
•
edited
Loading
edited
- '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',
- 'packages/desktop-client/src/components/budget/index.tsx',
- 'packages/desktop-client/src/components/budget/MobileBudget.tsx',
- 'packages/desktop-client/src/components/budget/envelope/HoldMenu.tsx',
- 'packages/desktop-client/src/components/budget/envelope/TransferMenu.tsx',
- 'packages/desktop-client/src/components/common/Menu.tsx',
- 'packages/desktop-client/src/components/FinancesApp.tsx',
- 'packages/desktop-client/src/components/GlobalKeys.ts',
- 'packages/desktop-client/src/components/LoggedInUser.tsx',
- 'packages/desktop-client/src/components/manager/ManagementApp.jsx',
- 'packages/desktop-client/src/components/manager/subscribe/common.tsx',
- 'packages/desktop-client/src/components/ManageRules.tsx',
- 'packages/desktop-client/src/components/mobile/MobileAmountInput.jsx',
- 'packages/desktop-client/src/components/mobile/MobileNavTabs.tsx',
- 'packages/desktop-client/src/components/Modals.tsx',
- 'packages/desktop-client/src/components/modals/EditRule.jsx',
- 'packages/desktop-client/src/components/modals/ImportTransactions.jsx',
- 'packages/desktop-client/src/components/modals/MergeUnusedPayees.jsx',
- 'packages/desktop-client/src/components/Notifications.tsx',
- 'packages/desktop-client/src/components/payees/ManagePayees.jsx',
- 'packages/desktop-client/src/components/payees/ManagePayeesWithData.jsx',
- 'packages/desktop-client/src/components/payees/PayeeTable.tsx',
- 'packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx',
- 'packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx',
- 'packages/desktop-client/src/components/reports/reports/CashFlowCard.jsx',
- 'packages/desktop-client/src/components/reports/reports/CustomReport.jsx',
- 'packages/desktop-client/src/components/reports/reports/NetWorthCard.jsx',
- 'packages/desktop-client/src/components/reports/SaveReportName.tsx',
- 'packages/desktop-client/src/components/reports/useReport.ts',
- 'packages/desktop-client/src/components/schedules/ScheduleDetails.jsx',
- 'packages/desktop-client/src/components/schedules/SchedulesTable.tsx',
- 'packages/desktop-client/src/components/select/DateSelect.tsx',
- 'packages/desktop-client/src/components/sidebar/Tools.tsx',
- 'packages/desktop-client/src/components/sort.tsx',
- 'packages/desktop-client/src/components/spreadsheet/useSheetValue.ts',
- 'packages/desktop-client/src/components/table.tsx',
- 'packages/desktop-client/src/components/Titlebar.tsx',
- 'packages/desktop-client/src/components/transactions/MobileTransaction.jsx',
- 'packages/desktop-client/src/components/transactions/SelectedTransactions.jsx',
- 'packages/desktop-client/src/components/transactions/SimpleTransactionsTable.jsx',
- 'packages/desktop-client/src/components/transactions/TransactionList.jsx',
- 'packages/desktop-client/src/components/transactions/TransactionsTable.jsx',
- 'packages/desktop-client/src/components/transactions/TransactionsTable.test.jsx',
- 'packages/desktop-client/src/hooks/useAccounts.ts',
- 'packages/desktop-client/src/hooks/useCategories.ts',
- 'packages/desktop-client/src/hooks/usePayees.ts',
- 'packages/desktop-client/src/hooks/useProperFocus.tsx',
- 'packages/desktop-client/src/hooks/useSelected.tsx',
- 'packages/loot-core/src/client/query-hooks.tsx',
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
WalkthroughThe pull request involves modifications to the ESLint configuration file ( Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/desktop-client/src/components/App.tsx (2)
Line range hint
166-192
: Consider separating scrollbar and sync logic!While the dependency array is correctly updated, consider splitting this useEffect into two separate ones:
- One for scrollbar checks
- Another for visibility change sync
This would improve code organization and make the effects more focused.
// Scrollbar effect useEffect(() => { function checkScrollbars() { if (hiddenScrollbars !== hasHiddenScrollbars()) { setHiddenScrollbars(hasHiddenScrollbars()); } } window.addEventListener('focus', checkScrollbars); return () => window.removeEventListener('focus', checkScrollbars); }, [hiddenScrollbars]); // Sync effect useEffect(() => { let isSyncing = false; async function onVisibilityChange() { if (!isSyncing) { console.debug('triggering sync because of visibility change'); isSyncing = true; await dispatch(sync()); isSyncing = false; } } window.addEventListener('visibilitychange', onVisibilityChange); return () => window.removeEventListener('visibilitychange', onVisibilityChange); }, [dispatch]);
112-112
: Use optional chaining for better readabilityReplace the current condition with optional chaining for a more concise expression.
- if (remoteFile && remoteFile.deleted) { + if (remoteFile?.deleted) {🧰 Tools
🪛 Biome (1.9.4)
[error] 112-112: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
eslint.config.mjs
(0 hunks)packages/desktop-client/src/components/App.tsx
(3 hunks)
💤 Files with no reviewable changes (1)
- eslint.config.mjs
🧰 Additional context used
🪛 Biome (1.9.4)
packages/desktop-client/src/components/App.tsx
[error] 112-112: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: web
- GitHub Check: typecheck
- GitHub Check: build (macos-latest)
- GitHub Check: Wait for Netlify build to finish
- GitHub Check: Analyze
- GitHub Check: build (windows-latest)
- GitHub Check: build (ubuntu-latest)
- GitHub Check: compare
🔇 Additional comments (2)
packages/desktop-client/src/components/App.tsx (2)
56-127
: Well-structured refactoring of update logic!The changes improve the code by:
- Moving
maybeUpdate
insideuseEffect
to prevent stale closures- Correctly declaring all required dependencies in the dependency array
- Maintaining proper error handling and state management
🧰 Tools
🪛 Biome (1.9.4)
[error] 112-112: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
Line range hint
132-147
: Correct dependency array update for token expiration handling!The dependencies array now properly includes all required functions:
addNotification
,signOut
, andt
.
Bundle Stats — desktop-clientHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller
Unchanged
|
Bundle Stats — loot-coreHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset No files were changed View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
const maybeUpdate = async <T,>(cb?: () => T): Promise<T> => { | ||
if (global.Actual.isUpdateReadyForDownload()) { | ||
useEffect(() => { | ||
const maybeUpdate = async <T,>(cb?: () => T): Promise<T> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved the init and maybeUpdate functions inside the useEffect