-
Notifications
You must be signed in to change notification settings - Fork 3
fix: Syncrhonization bugs and improvements on transaction form #146
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
Conversation
Code Review SummaryThis pull request introduces several important improvements across the synchronization core and related UI components. Key enhancements include robust error handling, efficient data fetching through pagination, improved dependency sorting for local changes, and better consistency in UI interactions when adding new entities. The overall changes make the synchronization process more reliable, performant, and maintainable. 🚀 Key Improvements
💡 Minor Suggestions
|
🔍 Code Review💡 1. **lib/data/sync/config_sync_handler.dart** (Lines 57-59) - REFACTORFollowing the change of Suggested Code: Current Code: @override
Future<Config?> restGetRemote(int id) async {
// return await remoteDataSource.getConfig(id);
return await remoteDataSource.getConfig(id.toString());
}Verdict: APPROVE Posted as a comment because posting a review failed. |
5c9ecea to
4875ab1
Compare
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.
Review complete. See the overview comment for a summary.
dcb3e9c to
a443fd3
Compare
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.
Review complete. See the overview comment for a summary.
4aafb37 to
c60d164
Compare
8019ce6 to
f368a38
Compare
Previously, remote datasources only fetched the first page of results during sync, causing data loss when more than 20 items needed syncing. Now all datasources loop through all pages using PaginationResponse.hasMore. Signed-off-by: nfebe <fenn25.fn@gmail.com>
Changed full sync strategy from delete-then-upsert to upsert-then-delete. This ensures existing local data is preserved if the upsert operation fails. Added deleteLocalNotIn method to SyncTypeHandler interface and all implementations to safely remove only items not in the server response. Signed-off-by: nfebe <fenn25.fn@gmail.com>
Wrapped unawaited sync calls with error logging to prevent silent failures. Sync errors are now logged instead of being swallowed. Signed-off-by: nfebe <fenn25.fn@gmail.com>
Entities skipped due to missing dependencies are now logged for debugging. The change stays in queue for retry on next sync cycle. Signed-off-by: nfebe <fenn25.fn@gmail.com>
Entities with no dependencies (wallet, category, party, group) are now uploaded before dependent entities (transaction). This prevents 403 errors when a transaction references entities not yet on the server. Signed-off-by: nfebe <fenn25.fn@gmail.com>
Related wallet/party/group entities are now only inserted if they don't exist locally, preventing overwrite of recent local changes. Signed-off-by: nfebe <fenn25.fn@gmail.com>
The FAB now uses the user's configured default wallet when opening the add transaction screen, instead of the carousel's current index. Signed-off-by: nfebe <fenn25.fn@gmail.com>
When a currency is selected, only show wallets that use that currency. Also clears wallet selection if its currency doesn't match the new one. Signed-off-by: nfebe <fenn25.fn@gmail.com>
When adding a new wallet, category, or party via the + button, the form now auto-selects the newly created item on return. Signed-off-by: nfebe <fenn25.fn@gmail.com>
Ensures newly created configs, wallets, and groups are synced to the server when first-time users complete the onboarding flow. Signed-off-by: nfebe <fenn25.fn@gmail.com>
Prevents ConstraintError when related entities exist by serverId but not by clientId. Uses insertOrReplace as fallback for edge cases. Also fixes: - setAmountController crash when creating new transactions - getLocalByClientId infinite recursion in CategorySyncHandler Signed-off-by: nfebe <fenn25.fn@gmail.com>
- Remove redundant serverId check in _doOperation (both branches identical) - Memoize getDependencyDepth results to avoid redundant calculations Signed-off-by: nfebe <fenn25.fn@gmail.com>
- Move sync error logging to SyncEntityRepository base class - Remove redundant _syncWithErrorHandling wrapper from TransactionRepository - Remove unnecessary existence checks before insertOrReplace (insertOrReplace handles both PK and UNIQUE constraint conflicts) Signed-off-by: nfebe <fenn25.fn@gmail.com>
f368a38 to
076aa69
Compare
- Await doSync() to complete before onboarding check - Check for existing group/wallet by name before creating new ones - Set existing entity as default if found during onboarding - Improve sync history display for config entity type
Syncrhonization bugs and improvements on transaction form