Skip to content
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

More typing improvements for Redux-related code #1404

Merged
merged 9 commits into from
Jul 28, 2023
Merged

Conversation

j-f1
Copy link
Contributor

@j-f1 j-f1 commented Jul 28, 2023

  • 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.

@netlify
Copy link

netlify bot commented Jul 28, 2023

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 55b88c4
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/64c348dd3950df0007454110
😎 Deploy Preview https://deploy-preview-1404.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 28, 2023

Bundle Stats - desktop-client

Hey 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

Files count Total bundle size % Changed
16 2.08 MB -> 2.08 MB (-7.77 KB) -0.36%
Changeset
File Δ Size
src/hooks/useSetThemeColor.ts 🆕 +305 B 0 B -> 305 B
src/components/settings/Export.js 📈 +139 B (+11.88%) 1.14 KB -> 1.28 KB
src/components/budget/DynamicBudgetTable.js 📈 +180 B (+9.16%) 1.92 KB -> 2.1 KB
src/components/settings/Global.js 📈 +131 B (+8.32%) 1.54 KB -> 1.67 KB
src/components/App.js 📈 +289 B (+8.10%) 3.48 KB -> 3.77 KB
src/components/settings/Reset.js 📈 +140 B (+7.56%) 1.81 KB -> 1.94 KB
src/components/settings/Themes.js 📈 +51 B (+7.30%) 699 B -> 750 B
src/components/settings/Format.js 📈 +226 B (+6.76%) 3.27 KB -> 3.49 KB
src/components/settings/Encryption.js 📈 +148 B (+5.02%) 2.88 KB -> 3.02 KB
src/components/budget/MobileBudget.js 📈 +227 B (+3.51%) 6.31 KB -> 6.53 KB
../loot-core/src/client/actions/account.ts 📈 +94 B (+2.54%) 3.62 KB -> 3.71 KB
src/components/budget/index.js 📈 +284 B (+2.09%) 13.29 KB -> 13.57 KB
src/components/modals/EditField.js 📈 +23 B (+0.72%) 3.13 KB -> 3.15 KB
src/components/accounts/MobileAccounts.js 📈 +26 B (+0.46%) 5.48 KB -> 5.5 KB
src/components/manager/ConfigServer.js 📈 +17 B (+0.42%) 3.99 KB -> 4 KB
src/components/manager/BudgetList.js 📈 +3 B (+0.05%) 6.05 KB -> 6.05 KB
src/components/payees/index.js 📉 -11 B (-0.10%) 10.59 KB -> 10.58 KB
src/components/Modals.tsx 📉 -16 B (-0.31%) 5.12 KB -> 5.11 KB
../loot-core/src/client/actions/budgets.ts 📉 -30 B (-0.55%) 5.37 KB -> 5.34 KB
src/components/accounts/AccountSyncCheck.js 📉 -20 B (-0.62%) 3.13 KB -> 3.11 KB
src/components/LoggedInUser.js 📉 -15 B (-0.71%) 2.05 KB -> 2.04 KB
src/components/FinancesApp.tsx 📉 -76 B (-0.97%) 7.68 KB -> 7.61 KB
src/components/payees/ManagePayeesWithData.js 📉 -38 B (-1.07%) 3.48 KB -> 3.44 KB
src/components/budget/MobileBudgetTable.js 📉 -248 B (-1.09%) 22.17 KB -> 21.93 KB
src/components/budget/misc.js 📉 -293 B (-1.19%) 24.13 KB -> 23.85 KB
src/components/manager/ManagementApp.js 📉 -76 B (-1.50%) 4.95 KB -> 4.88 KB
src/components/SidebarWithData.js 📉 -67 B (-1.81%) 3.61 KB -> 3.55 KB
../loot-core/src/client/actions/app.ts 📉 -14 B (-1.85%) 755 B -> 741 B
../loot-core/src/client/actions/queries.ts 📉 -120 B (-1.91%) 6.14 KB -> 6.02 KB
src/components/accounts/MobileAccount.js 📉 -123 B (-1.98%) 6.07 KB -> 5.95 KB
../loot-core/src/client/actions/sync.ts 📉 -39 B (-2.20%) 1.73 KB -> 1.7 KB
src/components/reports/Overview.js 📉 -165 B (-3.10%) 5.19 KB -> 5.03 KB
src/components/settings/index.js 📉 -161 B (-3.30%) 4.77 KB -> 4.61 KB
src/components/manager/WelcomeScreen.js 📉 -72 B (-3.49%) 2.02 KB -> 1.95 KB
src/components/Titlebar.js 📉 -376 B (-4.50%) 8.16 KB -> 7.79 KB
src/components/reports/NetWorth.js 📉 -163 B (-4.51%) 3.53 KB -> 3.37 KB
src/components/FloatableSidebar.js 📉 -106 B (-5.02%) 2.06 KB -> 1.96 KB
src/components/UpdateNotification.js 📉 -112 B (-5.39%) 2.03 KB -> 1.92 KB
src/components/manager/Modals.js 📉 -128 B (-6.01%) 2.08 KB -> 1.96 KB
src/components/BankSyncStatus.js 📉 -99 B (-7.39%) 1.31 KB -> 1.21 KB
../../node_modules/react-redux/es/connect/selectorFactory.js 🔥 -3.83 KB (-100%) 3.83 KB -> 0 B
../../node_modules/react-redux/es/utils/shallowEqual.js 🔥 -649 B (-100%) 649 B -> 0 B
src/util/withThemeColor.tsx 🔥 -645 B (-100%) 645 B -> 0 B
src/hooks/index.js 🔥 -181 B (-100%) 181 B -> 0 B
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/wide-components.chunk.js 159.09 KB -> 159.16 KB (+78 B) +0.05%

Smaller

Asset File Size % Changed
static/js/main.js 856 KB -> 848.52 KB (-7.48 KB) -0.87%
static/js/narrow-components.chunk.js 32.17 KB -> 31.94 KB (-238 B) -0.72%
static/js/reports.chunk.js 32.38 KB -> 32.25 KB (-135 B) -0.41%

Unchanged

Asset File Size % Changed
static/js/457.chunk.js 388.22 KB 0%
static/media/Inter-italic.var.woff2 239.29 KB 0%
static/media/Inter-roman.var.woff2 221.86 KB 0%
static/js/383.chunk.js 117.35 KB 0%
static/js/281.chunk.js 28.55 KB 0%
static/js/876.chunk.js 26.2 KB 0%
static/js/969.chunk.js 12.94 KB 0%
static/js/resize-observer-polyfill.chunk.js 8.12 KB 0%
static/css/main.css 5.82 KB 0%
asset-manifest.json 2.07 KB 0%
index.html 1.66 KB 0%
static/media/browser-server.js 963 B 0%

@github-actions
Copy link
Contributor

Bundle Stats - loot-core

Hey 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

Files count Total bundle size % Changed
2 1.97 MB 0%

Changeset

No files were changed

View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
kcab.worker.js 1010.37 KB 0%
xfo.xfo.kcab.worker.js 1004.04 KB 0%

@j-f1 j-f1 merged commit 9ef5fd1 into master Jul 28, 2023
15 checks passed
@j-f1 j-f1 deleted the jed/use-actions branch July 28, 2023 20:49
@trafico-bot trafico-bot bot added ✨ Merged Pull Request has been merged successfully and removed ✅ Approved labels Jul 28, 2023
FlorianLang06 pushed a commit to FlorianLang06/actual that referenced this pull request Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Merged Pull Request has been merged successfully
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants