fix: prevent false-positive conflict toast on first write to unbaselined keys - #77
Open
sunnyhaibin wants to merge 2 commits into
Open
sunnyhaibin wants to merge 2 commits into
sunnyhaibin wants to merge 2 commits into
Conversation
…ned keys verifyWrite was treating any stale readback as a device conflict when the key had no prior baseline entry (first-ever write, or fresh session after a firmware update rotates the git commit and clears the cache). valuesEqual returns false when compared against undefined, so any value from the poll that didn't match desiredValue immediately triggered "was changed on the device" and rolled back the UI — even though the write had succeeded. Two fixes: - batchPush: skip conflict detection in verifyWrite when baselineAtPushTime has no entry for the key; fall through to optimistic confirm and let drift detection surface genuine mismatches on the next poll cycle. - +layout.svelte: after the background prefetch, backfill the driftStore baseline with any freshly-fetched key that isn't already there. Closes the root cause so the guard rarely triggers in practice. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for sunnylink-frontend ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📊 Code Coverage Report
How to view detailed coverage
|
|
A new user left a comment. This user must be approved by a Netlify team owner before comments can be displayed. |
500ms was too aggressive for uncommon keys (Ford etc.) where POST takes 1.2–3.5s. Readback fired before the write applied, producing false-positive "changed on device" toasts. 2.5s covers observed round-trips with no UX cost — confirmKeys already fires optimistically.
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.
Fixes https://community.sunnypilot.ai/t/sunnylink-web-shows-was-changed-on-the-device-on-first-save-attempt-for-vehicle-brand-settings/5084