Fix odometer reading not updating after edit#407
Open
mitre88 wants to merge 1 commit intomikaelacaron:devfrom
Open
Fix odometer reading not updating after edit#407mitre88 wants to merge 1 commit intomikaelacaron:devfrom
mitre88 wants to merge 1 commit intomikaelacaron:devfrom
Conversation
Update the local readings array after a successful Firestore write in updateOdometerReading(), following the same pattern used in deleteReading(). This ensures the OdometerView reflects the updated value immediately without requiring a network refresh. Fixes mikaelacaron#297 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
|
thanks for working on this! Next time, please comment on the issue that you're working on it, and I'll assign you! I'll review this soon! I've been on holiday |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #297
When editing an odometer reading, the
OdometerViewwas still showing the old value after theEditOdometerReadingViewwas dismissed. This happened becauseupdateOdometerReading()updated Firestore but did not update the localreadingsarray.Changes
Updated
OdometerViewModel.updateOdometerReading()to sync the localreadingsarray after a successful Firestore write, following the same pattern already used indeleteReading().How it works
After
setData(from:)succeeds, the method now finds the reading by ID in the local array and replaces it with the updated value. This avoids an unnecessary network call while keeping the UI in sync.Testing
OdometerViewnow shows the updated value immediatelyScreenshots
N/A - Logic-only change, no UI modifications.