[PR #3395] [MERGED] ♻️ (synced-prefs) refactor some SyncedPrefs to string type #4829

Closed
opened 2026-02-28 21:01:53 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/3395
Author: @MatissJanis
Created: 9/8/2024
Status: Merged
Merged: 9/8/2024
Merged by: @MatissJanis

Base: masterHead: matiss/synced-prefs-1


📝 Commits (5)

  • 43004f1 ♻️ (synced-prefs) refactor some SyncedPrefs to string type
  • 455f758 Release notes
  • afbb9e8 Fix linter
  • c77d9cf Convert the other prefs too
  • a870184 Simplified usePrivacyMode

📊 Changes

21 files changed (+125 additions, -97 deletions)

View changed files

📝 packages/desktop-client/src/components/Titlebar.tsx (+4 -3)
📝 packages/desktop-client/src/components/accounts/Account.tsx (+14 -10)
📝 packages/desktop-client/src/components/mobile/accounts/Account.jsx (+1 -1)
📝 packages/desktop-client/src/components/mobile/accounts/AccountTransactions.jsx (+0 -2)
📝 packages/desktop-client/src/components/mobile/accounts/Accounts.jsx (+1 -1)
📝 packages/desktop-client/src/components/mobile/budget/Category.tsx (+1 -1)
📝 packages/desktop-client/src/components/mobile/budget/CategoryTransactions.jsx (+0 -2)
📝 packages/desktop-client/src/components/mobile/budget/index.tsx (+7 -3)
📝 packages/desktop-client/src/components/mobile/transactions/FocusableAmountInput.tsx (+2 -2)
📝 packages/desktop-client/src/components/modals/ImportTransactions.jsx (+13 -8)
📝 packages/desktop-client/src/components/settings/Experimental.tsx (+1 -1)
📝 packages/desktop-client/src/components/settings/Format.tsx (+6 -5)
📝 packages/desktop-client/src/components/util/AmountInput.tsx (+4 -2)
📝 packages/desktop-client/src/hooks/useFeatureFlag.ts (+1 -1)
📝 packages/desktop-client/src/hooks/usePrivacyMode.ts (+3 -6)
📝 packages/loot-core/src/client/reducers/prefs.ts (+15 -7)
📝 packages/loot-core/src/client/selectors.ts (+3 -3)
📝 packages/loot-core/src/shared/util.ts (+14 -6)
📝 packages/loot-core/src/types/prefs.d.ts (+21 -26)
📝 tsconfig.json (+8 -7)

...and 1 more files

📄 Description

We discussed this in private among the maintainers, but here's the TLDR:

SyncedPrefs are getting moved to the database. The database for synced prefs no notion of data types of the values (i.e. number, boolean, enum). All the values there are treated as string.

Which means we need to decide between:

  1. using string for all the values in the UI code as well or
  2. implement conversion/type-guard logic inside the useSyncedPrefs

We decided to go with (1) because that's generally the more simple solution. (2) would require implementation of lots of logic which would make the seemingly simple hook very verbose.

This PR converts the SyncedPrefs to string type.


🔄 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/3395 **Author:** [@MatissJanis](https://github.com/MatissJanis) **Created:** 9/8/2024 **Status:** ✅ Merged **Merged:** 9/8/2024 **Merged by:** [@MatissJanis](https://github.com/MatissJanis) **Base:** `master` ← **Head:** `matiss/synced-prefs-1` --- ### 📝 Commits (5) - [`43004f1`](https://github.com/actualbudget/actual/commit/43004f1eebfe76ae8bacb37e1234a6fc64fa2e25) :recycle: (synced-prefs) refactor some SyncedPrefs to string type - [`455f758`](https://github.com/actualbudget/actual/commit/455f758960b5c0338433d4f205945745d1714623) Release notes - [`afbb9e8`](https://github.com/actualbudget/actual/commit/afbb9e890b7a9b41eb17cca63af04bfd014d09aa) Fix linter - [`c77d9cf`](https://github.com/actualbudget/actual/commit/c77d9cfbb52a461fed209d91dae1757f0bd75169) Convert the other prefs too - [`a870184`](https://github.com/actualbudget/actual/commit/a870184f0dbdf82082085b4a72ef1dea378dd88f) Simplified usePrivacyMode ### 📊 Changes **21 files changed** (+125 additions, -97 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/Titlebar.tsx` (+4 -3) 📝 `packages/desktop-client/src/components/accounts/Account.tsx` (+14 -10) 📝 `packages/desktop-client/src/components/mobile/accounts/Account.jsx` (+1 -1) 📝 `packages/desktop-client/src/components/mobile/accounts/AccountTransactions.jsx` (+0 -2) 📝 `packages/desktop-client/src/components/mobile/accounts/Accounts.jsx` (+1 -1) 📝 `packages/desktop-client/src/components/mobile/budget/Category.tsx` (+1 -1) 📝 `packages/desktop-client/src/components/mobile/budget/CategoryTransactions.jsx` (+0 -2) 📝 `packages/desktop-client/src/components/mobile/budget/index.tsx` (+7 -3) 📝 `packages/desktop-client/src/components/mobile/transactions/FocusableAmountInput.tsx` (+2 -2) 📝 `packages/desktop-client/src/components/modals/ImportTransactions.jsx` (+13 -8) 📝 `packages/desktop-client/src/components/settings/Experimental.tsx` (+1 -1) 📝 `packages/desktop-client/src/components/settings/Format.tsx` (+6 -5) 📝 `packages/desktop-client/src/components/util/AmountInput.tsx` (+4 -2) 📝 `packages/desktop-client/src/hooks/useFeatureFlag.ts` (+1 -1) 📝 `packages/desktop-client/src/hooks/usePrivacyMode.ts` (+3 -6) 📝 `packages/loot-core/src/client/reducers/prefs.ts` (+15 -7) 📝 `packages/loot-core/src/client/selectors.ts` (+3 -3) 📝 `packages/loot-core/src/shared/util.ts` (+14 -6) 📝 `packages/loot-core/src/types/prefs.d.ts` (+21 -26) 📝 `tsconfig.json` (+8 -7) _...and 1 more files_ </details> ### 📄 Description We discussed this in private among the maintainers, but here's the TLDR: SyncedPrefs are getting moved to the database. The database for synced prefs no notion of data types of the values (i.e. number, boolean, enum). All the values there are treated as `string`. Which means we need to decide between: 1. using `string` for all the values in the UI code as well or 2. implement conversion/type-guard logic inside the `useSyncedPrefs` We decided to go with (1) because that's generally the more simple solution. (2) would require implementation of lots of logic which would make the seemingly simple hook very verbose. This PR converts the SyncedPrefs to `string` type. --- <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 21:01:53 -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#4829