-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
♻️ (synced-prefs) move budget type to synced prefs #3427
Conversation
@@ -174,17 +174,3 @@ export async function prewarmAllMonths( | |||
months.map(month => prewarmMonth(budgetType, spreadsheet, month)), | |||
); | |||
} | |||
|
|||
export async function switchBudgetType( |
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.
Not necessary anymore IMO. We already do the prewarming operation in the budget page - inside a useEffect
hook. So whenever budgetType
changes - the prewarming will be performed.
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 No assets were 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
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller No assets were smaller Unchanged No assets were unchanged |
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@coderabbitai full review |
Actions performedFull review triggered. |
WalkthroughThe changes involve a comprehensive update to the management of the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI
participant Server
participant Database
User->>UI: Request Budget Type
UI->>Server: Fetch Budget Type
Server->>Database: Query Budget Type
Database-->>Server: Return Budget Type
Server-->>UI: Send Budget Type
UI-->>User: Display Budget Type
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
Outside diff range and nitpick comments (1)
upcoming-release-notes/3352.md (1)
6-6
: Fix the typo in the change description.The change description seems to have a typo or grammatical error. It currently reads:
Support translations in Translation support for desktop-client/src/components/budget/BalanceWithCarryover.tsx
Consider rephrasing it to something like:
Added translation support for desktop-client/src/components/budget/BalanceWithCarryover.tsx
This will make the description clearer and easier to understand.
-Support translations in Translation support for desktop-client/src/components/budget/BalanceWithCarryover.tsx +Added translation support for desktop-client/src/components/budget/BalanceWithCarryover.tsx
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (17)
- packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx (2 hunks)
- packages/desktop-client/src/components/budget/index.tsx (2 hunks)
- packages/desktop-client/src/components/budget/util.ts (3 hunks)
- packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx (3 hunks)
- packages/desktop-client/src/components/mobile/budget/index.tsx (1 hunks)
- packages/desktop-client/src/components/settings/BudgetTypeSettings.tsx (1 hunks)
- packages/desktop-client/src/components/settings/Experimental.tsx (1 hunks)
- packages/loot-core/migrations/1723665565000_prefs.js (1 hunks)
- packages/loot-core/src/server/budget/actions.ts (1 hunks)
- packages/loot-core/src/server/main.ts (1 hunks)
- packages/loot-core/src/server/prefs.ts (1 hunks)
- packages/loot-core/src/server/sheet.ts (1 hunks)
- packages/loot-core/src/server/sync/index.ts (1 hunks)
- packages/loot-core/src/types/prefs.d.ts (1 hunks)
- packages/loot-core/src/types/server-handlers.d.ts (0 hunks)
- upcoming-release-notes/3352.md (1 hunks)
- upcoming-release-notes/3427.md (1 hunks)
Files not reviewed due to no reviewable changes (1)
- packages/loot-core/src/types/server-handlers.d.ts
Additional comments not posted (25)
upcoming-release-notes/3427.md (1)
1-6
: Release notes look good!The release notes follow the standard format and accurately describe the change being made in this PR. The category, author, and description are all relevant and clear.
packages/loot-core/migrations/1723665565000_prefs.js (1)
15-15
: LGTM! The change aligns with the transition ofbudgetType
to synced preferences.Uncommenting the entry for
'budgetType'
in theSYNCED_PREF_KEYS
array is a logical step in the process of transitioning thebudgetType
preference from metadata to synced preferences. This change ensures thatbudgetType
is now actively managed as part of the synchronization process, allowing it to be stored and retrieved alongside other preference keys.The overall functionality is enhanced by treating
budgetType
consistently with the other keys in the synchronization logic, which may affect how user preferences are persisted and accessed across sessions. This change promotes a more unified and reliable approach to managing user preferences.packages/desktop-client/src/components/settings/BudgetTypeSettings.tsx (6)
1-1
: LGTM!The
React
import is necessary and correctly added.
3-3
: LGTM!The
useSyncedPref
hook is correctly imported and aligns with the changes mentioned in the summary.
4-4
: LGTM!The
Button
component is correctly imported and used in the component.
11-11
: LGTM!The
useSyncedPref
hook is correctly used to manage thebudgetType
state, and the default value is set appropriately.
14-15
: LGTM!The logic for updating the
budgetType
state is correct, and thesetBudgetType
function is correctly used.
21-24
: LGTM!The
Button
component is correctly used with theonSwitchType
function, and the dynamic button text accurately reflects the action of switching between budgeting types.packages/loot-core/src/server/prefs.ts (1)
Line range hint
47-55
: Clarify the handling ofbudgetType
after the removal from sync logic.The removal of
budgetType
from the sync logic in thesavePrefs
function suggests a change in how this preference is being managed. It would be helpful to understand the reasoning behind this modification and howbudgetType
is being handled in other parts of the application after this change.Please ensure that the removal of
budgetType
from this section does not introduce any unintended consequences or inconsistencies in the application's behavior related to budget types.packages/loot-core/src/types/prefs.d.ts (1)
15-15
: Verify the impact of movingbudgetType
toSyncedPrefs
.The change is consistent with the AI-generated summary and implies that
budgetType
will now be synchronized across devices.Run the following script to verify the usage of
budgetType
and ensure that all references have been updated to useSyncedPrefs
:Additionally, consider the implications of synchronizing
budgetType
across devices on the user experience and data consistency. Ensure that the synchronization behavior aligns with the intended design.Verification successful
Verification successful:
budgetType
migration toSyncedPrefs
is complete and consistent.The codebase analysis confirms that:
- All references to
MetadataPrefs.budgetType
have been removed.budgetType
is now accessed using theuseSyncedPref
hook, indicating proper integration withSyncedPrefs
.- The change has been consistently applied across various components and utilities.
No further action is required regarding this change.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to `budgetType` have been updated to use `SyncedPrefs`. # Test: Search for references to `budgetType`. Expect: No references to `MetadataPrefs.budgetType`. rg --type typescript $'budgetType'Length of output: 68
Script:
#!/bin/bash # Description: Verify all references to `budgetType` have been updated to use `SyncedPrefs`. # Search for all occurrences of `budgetType` echo "Searching for all occurrences of budgetType:" rg --type-add 'ts:*.{ts,tsx}' --type-add 'js:*.{js,jsx}' --type ts --type js 'budgetType' echo -e "\nSearching for any remaining references to MetadataPrefs.budgetType:" rg --type-add 'ts:*.{ts,tsx}' --type-add 'js:*.{js,jsx}' --type ts --type js 'MetadataPrefs\.budgetType' echo -e "\nSearching for new references to SyncedPrefs.budgetType:" rg --type-add 'ts:*.{ts,tsx}' --type-add 'js:*.{js,jsx}' --type ts --type js 'SyncedPrefs\.budgetType'Length of output: 7854
packages/desktop-client/src/components/settings/Experimental.tsx (1)
72-72
: LGTM!The change from
useMetadataPref
touseSyncedPref
for retrieving thebudgetType
preference is a good refactor. UsinguseSyncedPref
potentially improves the synchronization and consistency of thebudgetType
preference across different components or sessions in the application.The default value for
budgetType
remains 'rollover', ensuring that existing functionality is preserved. The logic for determining the enabled state of the budget report feature and the condition for blocking the toggle also remains unchanged, indicating that the core functionality of the feature toggle is intact despite the underlying change in preference management.packages/desktop-client/src/components/budget/util.ts (3)
7-7
: LGTM!The import statement for
SyncedPrefs
type is correct and aligns with the transition fromMetadataPrefs
toSyncedPrefs
mentioned in the summary.
144-144
: LGTM!The
budgetType
parameter type change in theprewarmMonth
function is correct and aligns with the transition fromMetadataPrefs
toSyncedPrefs
.
159-159
: LGTM!The
budgetType
parameter type change in theprewarmAllMonths
function is correct and aligns with the transition fromMetadataPrefs
toSyncedPrefs
.packages/loot-core/src/server/sheet.ts (1)
198-201
: Approve the changes to retrievebudgetType
from the database.The new implementation ensures that the
budgetType
is always fetched from the database, which is a more robust and centralized approach compared to the previous implementation that relied on theprefs
module. This change allows for more dynamic updates to user preferences without requiring changes to the codebase.The default value of
'rollover'
is used if nobudgetType
is found in the database, which maintains backward compatibility and prevents unexpected behavior.packages/loot-core/src/server/budget/actions.ts (2)
30-30
: LGTM!The change in the function logic to call
isReflectBudget()
instead of usingprefs.getPrefs()
is consistent with the alterations mentioned in the summary. The implementation looks good.
34-37
: Looks good!The change in the function implementation to retrieve
budgetType
from the database instead of usingprefs.getPrefs()
is a good improvement. It enhances the reliability of the budget type retrieval by ensuring it is sourced directly from the database.The SQL query and the logic to determine if the budget type is 'report' are implemented correctly.
packages/desktop-client/src/components/budget/index.tsx (2)
28-28
: LGTM!The import change from
useMetadataPref
touseSyncedPref
aligns with the PR objective of moving the budget type to synced preferences. This is a good refactor to centralize preference management.
81-81
: VerifyuseSyncedPref
usage forbudgetType
across the codebase.The change from
useMetadataPref
touseSyncedPref
for managing thebudgetType
preference aligns with the PR objective and is a good refactor.However, it's important to ensure that all relevant components have been updated to use
useSyncedPref
forbudgetType
to maintain consistency across the application.Run the following script to verify the usage of
useSyncedPref
forbudgetType
:Verification successful
Migration to
useSyncedPref
for 'budgetType' successfully implementedThe verification process confirms that the migration from
useMetadataPref
touseSyncedPref
for the 'budgetType' preference has been successfully and consistently implemented across the codebase. Key observations:
- No occurrences of
useMetadataPref('budgetType')
were found.useSyncedPref('budgetType')
is now used in multiple components, including:
- Mobile and desktop budget components
- Category autocomplete
- Settings (Experimental and BudgetTypeSettings)
The change has been applied comprehensively, maintaining consistency across different parts of the application. The default value of 'rollover' is also consistently used, ensuring backward compatibility.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify `useSyncedPref` is used for `budgetType` across the codebase. # Test: Search for the usage of `useMetadataPref` with `budgetType`. Expect: No occurrences. rg --type typescript -A 5 $'useMetadataPref\(\'budgetType\'\)' # Test: Search for the usage of `useSyncedPref` with `budgetType`. Expect: Only occurrences of the new usage. rg --type typescript -A 5 $'useSyncedPref\(\'budgetType\'\)'Length of output: 203
Script:
#!/bin/bash # Description: Verify `useSyncedPref` is used for `budgetType` across the codebase. # Test: Search for the usage of `useMetadataPref` with `budgetType`. Expect: No occurrences. echo "Searching for useMetadataPref('budgetType'):" fd -e ts -e tsx | xargs rg -n -A 5 "useMetadataPref\('budgetType'\)" echo "" echo "Searching for useSyncedPref('budgetType'):" # Test: Search for the usage of `useSyncedPref` with `budgetType`. Expect: Only occurrences of the new usage. fd -e ts -e tsx | xargs rg -n -A 5 "useSyncedPref\('budgetType'\)"Length of output: 3681
packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx (1)
382-382
: LGTM!The change from
useMetadataPref
touseSyncedPref
for retrieving thebudgetType
preference aligns with the PR objective and should improve the consistency of preference synchronization. The default value and the subsequent logic remain unchanged, ensuring no functional impact.packages/desktop-client/src/components/mobile/budget/index.tsx (1)
45-45
: LGTM!The change from
useMetadataPref
touseSyncedPref
for retrieving thebudgetType
preference is a good move. It ensures that the preference is consistently synchronized across components or sessions, potentially improving the user experience.The surrounding logic remains intact, and the change is isolated to the preference retrieval without affecting the functionality of the
Budget
component.packages/loot-core/src/server/sync/index.ts (1)
362-366
: LGTM!The new conditional logic for handling the
budgetType
preference synchronization is a great addition. It ensures that the application state is updated in real-time when thebudgetType
preference is detected in the incoming messages.This change improves the responsiveness of the application and provides immediate feedback to the user when the
budgetType
preference is updated. The code segment is logically correct and aligns with the objective of enhancing the synchronization of thebudgetType
preference.Good job on streamlining the control flow by centralizing the handling of the
budgetType
preference in one location.packages/loot-core/src/server/main.ts (1)
1980-1984
: LGTM!The change to retrieve the budget type from the database instead of user preferences is a good refactor for centralization and consistency. The default value of
'rollover'
maintains backward compatibility.packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx (2)
228-229
: LGTM! Verify theuseSyncedPref
hook implementation.The change from
useMetadataPref
touseSyncedPref
for managing thebudgetType
preference looks good. It suggests a shift towards a more centralized approach to preference synchronization.Please ensure that the
useSyncedPref
hook is implemented correctly and provides the expected functionality for consistent preference management across the application.
361-362
: LGTM! Verify theuseSyncedPref
hook implementation.The change from
useMetadataPref
touseSyncedPref
for managing thebudgetType
preference in theExpenseCategory
function looks good. It maintains consistency with the similar change made in theBudgetCell
function.Please ensure that the
useSyncedPref
hook is implemented correctly and provides the expected functionality for consistent preference management across the application.
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.
LGTM
* marked files for translation * added release note * fixed linting warnings * 🐛 fix account filters being overridden (#3441) * Reduce package size (#3443) * reduce package size of all packages * release notes * Update beforePackHook.ts * [Maintenance] Cleanup react aria packages and dedupe (#3450) * Cleanup react aria packages and dedupe * Release notes * ♻️ (synced-prefs) moving the prefs from metadata.json to the db (#3423) * Restart server silently when adding self signed cert and add some logs (#3431) * restart server silently on add self signed cert and add some logging * release notes * fix name * updating names to be more specific * removing setloading * feedback * ♻️ (synced-prefs) move budget type to synced prefs (#3427) * update synced account balance in db if available (#3452) * 🐛 (synced-prefs) fix bulk-reading not working in import modal (#3460) * fix: csv import deduplication (#3456) * ✨ release simplefin as a first-party feature (#3459) Closes #2272 * Do not allow renaming to an empty category or group name (#3463) * Do not allow renaming to an emoty category or group name * Release notes * [Mobile] Fix #3214 - Pull down to refresh triggering clicks on budget cells (#3374) * Fix #3214 * Fix rollover indicator * VRT * Fix typecheck error * VRT * Release notes * VRT * Update style * Fix budgeted * VRT * VRT * Revert VRT * VRT * Fix style * Revert usePreviewTransactions * Fix error * Fix reports form submit handlers (#3462) * Fix form submit handlers * Release notes * Remove some old updater code (#3468) * remove some old updater code * remove old updater logic * CSV import e2e tests (#3467) * Fix React Aria Button hover styles (#3453) * Fiox hover styles and use className instead of inline to prepare for future css migration * Release notes * Cleanup * Update edit rule hover style * Undoable auto transfer notes + auto notes for cover (#3411) * Undo auto transfer notes + auto notes for cover * Release notes * Fix notes * Fix notes undo * Do not show clicked category on transfer or cover menus * Fix typecheck error * typecheck * Fix removeCategoriesFromGroups * 🐛 (reports) deleting custom report should remove it from the dashboard (#3469) * Revert "CSV import e2e tests (#3467)" (#3474) This reverts commit 5e12d40. * ♻️ (synced-prefs) separate metadata and local prefs out (#3458) * Replace deprecated file protocol registration (#3475) * replace deprecated file handler in electron * release notes * types eh * types * update sql regexp to default to empty string when field is null (#3480) * ♻️ rename report/rollover budget to tracking/envelope (#3483) * 🐛 (import) fix csv import checkboxes not working (#3478) * Update tooltip and themes with better visibility (#3298) * Update tooltip and themes with better visibility * Rename merge request # into release notes * rename release note * update VRT * tweak light theme * dont put border on autocomplete menus * update VRT * tweak popover style * simplify * update VRT * update VRT --------- Co-authored-by: Dustin Conlon <dustin@dustinconlon.com> Co-authored-by: Dustin Conlon <58367364+VoltaicGRiD@users.noreply.github.com> Co-authored-by: youngcw <calebyoung94@gmail.com> * fix modals on mobile BudgetTable (#3487) * Fix privacy filter (#3472) * Fix privacy filter * Release notes * Coderabbit suggestion * VRT * VRT * Revert VRT * VRT * VRT * VRT * VRT * Delete VRT * VRT * Revert VRT * 🐛 fix custom reports crashing when opening table (#3484) * 🧪 (tests) adding custom report e2e tests (#3493) * ✨ (dashboards) ability to save filters & timeframes on spending widgets (#3432) * marked files for translation * Revert ":bug: fix account filters being overridden (#3441)" This reverts commit 7336bad. * Revert "Revert ":bug: fix account filters being overridden (#3441)"" This reverts commit 5cbadc4. * Revert changes due to failed rebase * removed import of t * fixed lint warning * added PayeeTableRow.tsx * needed changes * bugfix: pluralization * variables adjustments * removed doubled trans --------- Co-authored-by: Matiss Janis Aboltins <matiss@mja.lv> Co-authored-by: Michael Clark <5285928+MikesGlitch@users.noreply.github.com> Co-authored-by: Joel Jeremy Marquez <joeljeremy.marquez@gmail.com> Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk> Co-authored-by: Koen van Staveren <koenvanstaveren@hotmail.com> Co-authored-by: Ryan Bianchi <1435081+qedi-r@users.noreply.github.com> Co-authored-by: Robert Dyer <rdyer@unl.edu> Co-authored-by: Dustin Conlon <dustin@dustinconlon.com> Co-authored-by: Dustin Conlon <58367364+VoltaicGRiD@users.noreply.github.com> Co-authored-by: youngcw <calebyoung94@gmail.com> Co-authored-by: Tim <hello@timsmart.co>
Depends on #3423
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Refactor
Chores