fix(ios): a value typed into the profile stays typed, and says it was entered by you - #239
Merged
Merged
Conversation
… entered by you A weight typed by hand reverted to the one read from the reports a moment later, which is the opposite of what a field is for. The fields were seeded with `State(initialValue:)` inside the initialiser, and a sheet's content closure is rebuilt more than once. Each rebuild re-ran the initialiser and put the stored value back over the edit. The field accepted the keystrokes and showed them until the next redraw, which reads like a binding problem and is not one. They are seeded once now, in `onAppear`, guarded by a flag. The initialiser stores the `let`s and nothing else. And an edit means what it says. Typing a figure means it was measured now, so its date moves to today and the row stops claiming the value came from a report: it says "entered by you" instead. Typing the old figure back puts both claims back as they were, because that is no longer an edit. Saving already files each measurement under its own date, so a corrected weight now lands on today rather than on the day the old one was measured. Refs #186. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LFMtTkqc3btcaWNur2A93P
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.
A weight typed by hand reverted to the one read from the reports a moment later, which is the opposite of what a field is for.
The cause
The fields were seeded with
State(initialValue:)insideProfileView.init, and a sheet's content closure is rebuilt more than once. Each rebuild re-ran the initialiser and put the stored value back over the edit.The field accepted the keystrokes and showed them until the next redraw, which reads like a binding problem and is not one. Recorded in
docs/gotchas.md.They are seeded once now, in
onAppear, guarded by a flag. The initialiser stores thelets and nothing else.An edit now means what it says
Typing a figure means it was measured now. So its date moves to today, and the row stops claiming the value came from a report: it says entered by you instead.
Typing the old figure back puts both claims back as they were, because that is no longer an edit.
Saving already files each measurement under its own date, so a corrected weight lands on today rather than on the day the old one was measured.
Gates
swift testScripts/run-ui-tests.shcheck-localization.shA new UI test types into the weight field, checks the field holds it, checks the row says it was entered by you, and checks it is still there after the screen has been rebuilt. It fails against the old code.
Installed on the phone.
Refs #186.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LFMtTkqc3btcaWNur2A93P