[PR #1404] [MERGED] More typing improvements for Redux-related code #3716

Closed
opened 2026-02-28 20:45:41 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/1404
Author: @j-f1
Created: 7/28/2023
Status: Merged
Merged: 7/28/2023
Merged by: @j-f1

Base: masterHead: jed/use-actions


📝 Commits (9)

📊 Changes

50 files changed (+534 additions, -672 deletions)

View changed files

📝 packages/desktop-client/src/components/App.js (+23 -10)
📝 packages/desktop-client/src/components/BankSyncStatus.js (+4 -11)
📝 packages/desktop-client/src/components/FinancesApp.tsx (+10 -12)
📝 packages/desktop-client/src/components/FloatableSidebar.js (+6 -9)
📝 packages/desktop-client/src/components/LoggedInUser.js (+5 -17)
📝 packages/desktop-client/src/components/Modals.tsx (+0 -1)
📝 packages/desktop-client/src/components/SidebarWithData.js (+13 -26)
📝 packages/desktop-client/src/components/Titlebar.js (+31 -64)
📝 packages/desktop-client/src/components/UpdateNotification.js (+10 -19)
📝 packages/desktop-client/src/components/accounts/AccountSyncCheck.js (+7 -17)
📝 packages/desktop-client/src/components/accounts/MobileAccount.js (+14 -19)
📝 packages/desktop-client/src/components/accounts/MobileAccounts.js (+23 -25)
📝 packages/desktop-client/src/components/budget/DynamicBudgetTable.js (+6 -0)
📝 packages/desktop-client/src/components/budget/MobileBudget.js (+26 -16)
📝 packages/desktop-client/src/components/budget/MobileBudgetTable.js (+1 -14)
📝 packages/desktop-client/src/components/budget/index.js (+24 -16)
📝 packages/desktop-client/src/components/budget/misc.js (+1 -16)
📝 packages/desktop-client/src/components/manager/BudgetList.js (+14 -18)
📝 packages/desktop-client/src/components/manager/ConfigServer.js (+1 -1)
📝 packages/desktop-client/src/components/manager/ManagementApp.js (+11 -23)

...and 30 more files

📄 Description

  • All connect calls have been replaced with useSelector()/useActions()
    • this may help reduce re-renders
    • most importantly, the only props declared on virtually all components are the ones you are expected to pass to them explicitly. This means no magic action props that are confusable with manually passed callbacks. I didn’t go all the way with this, a future direction would be to review action usage and port older class components to functions so they can use useActions
  • moved some useSelector calls down into the actual component that uses them (which should reduce re-renders)
  • withThemeColor has been fully replaced by useSetThemeColor
  • Action types have been redone to make them more accurate. In particular, the return types of actions are now correct if they returned thunks. (e.g. getAccounts() is now correctly typed as returning Promise<AccountEntity[]> instead of the (dispatch) => Promise<AccountEntity[]> thunk.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/1404 **Author:** [@j-f1](https://github.com/j-f1) **Created:** 7/28/2023 **Status:** ✅ Merged **Merged:** 7/28/2023 **Merged by:** [@j-f1](https://github.com/j-f1) **Base:** `master` ← **Head:** `jed/use-actions` --- ### 📝 Commits (9) - [`e249515`](https://github.com/actualbudget/actual/commit/e2495150c636157dd70d26d649ece887584bab32) Refactor useSetThemeColor - [`29597b2`](https://github.com/actualbudget/actual/commit/29597b2ce47347fb0f933f73aa13508f595ff474) Port connect() use to useSelector()/useAction() - [`5d44313`](https://github.com/actualbudget/actual/commit/5d443136a7ec4354c0dae72c9d27ec5a2cf96e40) Remove unused withThemeColor - [`db5d97a`](https://github.com/actualbudget/actual/commit/db5d97acb1cf2ace40c3af8a53b37d980c07d1ef) Port class-based components to useSelector/useActions - [`bde32d8`](https://github.com/actualbudget/actual/commit/bde32d8de7b6944f83ec2e819e2f5ab2f85e756a) Fix action typing - [`53579c2`](https://github.com/actualbudget/actual/commit/53579c251148198d31d0d9ff3bdf3935d533a86d) Resolve type errors - [`c863732`](https://github.com/actualbudget/actual/commit/c8637321f6417a75c58205f98460af940409ad4d) lint fixes - [`12d8afc`](https://github.com/actualbudget/actual/commit/12d8afc9accf946e817a3fc78c9f280e395cdd77) Remove debugger - [`55b88c4`](https://github.com/actualbudget/actual/commit/55b88c4253a1de9a99d8d1e3d22c9fdad8b5ebbe) Add release note ### 📊 Changes **50 files changed** (+534 additions, -672 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/App.js` (+23 -10) 📝 `packages/desktop-client/src/components/BankSyncStatus.js` (+4 -11) 📝 `packages/desktop-client/src/components/FinancesApp.tsx` (+10 -12) 📝 `packages/desktop-client/src/components/FloatableSidebar.js` (+6 -9) 📝 `packages/desktop-client/src/components/LoggedInUser.js` (+5 -17) 📝 `packages/desktop-client/src/components/Modals.tsx` (+0 -1) 📝 `packages/desktop-client/src/components/SidebarWithData.js` (+13 -26) 📝 `packages/desktop-client/src/components/Titlebar.js` (+31 -64) 📝 `packages/desktop-client/src/components/UpdateNotification.js` (+10 -19) 📝 `packages/desktop-client/src/components/accounts/AccountSyncCheck.js` (+7 -17) 📝 `packages/desktop-client/src/components/accounts/MobileAccount.js` (+14 -19) 📝 `packages/desktop-client/src/components/accounts/MobileAccounts.js` (+23 -25) 📝 `packages/desktop-client/src/components/budget/DynamicBudgetTable.js` (+6 -0) 📝 `packages/desktop-client/src/components/budget/MobileBudget.js` (+26 -16) 📝 `packages/desktop-client/src/components/budget/MobileBudgetTable.js` (+1 -14) 📝 `packages/desktop-client/src/components/budget/index.js` (+24 -16) 📝 `packages/desktop-client/src/components/budget/misc.js` (+1 -16) 📝 `packages/desktop-client/src/components/manager/BudgetList.js` (+14 -18) 📝 `packages/desktop-client/src/components/manager/ConfigServer.js` (+1 -1) 📝 `packages/desktop-client/src/components/manager/ManagementApp.js` (+11 -23) _...and 30 more files_ </details> ### 📄 Description - All `connect` calls have been replaced with `useSelector()`/`useActions()` - this may help reduce re-renders - most importantly, the only props declared on virtually all components are the ones you are expected to pass to them explicitly. This means no magic action props that are confusable with manually passed callbacks. I didn’t go all the way with this, a future direction would be to review action usage and port older class components to functions so they can use `useActions` - moved some `useSelector` calls down into the actual component that uses them (which should reduce re-renders) - `withThemeColor` has been fully replaced by `useSetThemeColor` - Action types have been redone to make them more accurate. In particular, the return types of actions are now correct if they returned thunks. (e.g. `getAccounts()` is now correctly typed as returning `Promise<AccountEntity[]>` instead of the `(dispatch) => Promise<AccountEntity[]>` thunk. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-02-28 20:45:41 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#3716