Fix #5024: treat Picker.setDate(null) as an explicit clear#5025
Merged
Conversation
setDate(null) previously left dateValueExplicitlySet=false, so a subsequent getDate() on a Picker with setDefaultDate(...) installed silently returned the default getter's result - making getDate() report a date the user had never seen or accepted. Mark the value as explicitly set even for null, so getDate() returns null until the caller pins a new date or the user commits one through the popup. The default getter still primes the popup wheels on the next open via applyDefaultDateIfNeeded (now also triggered when an explicit value of null is present), so the UI keeps a sensible starting point. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
✅ Continuous Quality ReportTest & Coverage
Static Analysis
Generated automatically by the PR CI workflow. |
Collaborator
Author
|
Compared 110 screenshots: 110 matched. Benchmark Results
Build and Run Timing
Detailed Performance Metrics
|
Collaborator
Author
|
Compared 110 screenshots: 110 matched. Native Android coverage
✅ Native Android screenshot tests passed. Native Android coverage
Benchmark ResultsDetailed Performance Metrics
|
Collaborator
Author
|
Compared 110 screenshots: 110 matched. Benchmark Results
Build and Run Timing
Detailed Performance Metrics
|
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.
Summary
setDate(null)on aPickerconfigured withsetDefaultDate(...)no longer silently substitutes the default getter's value throughgetDate(). AftersetDate(null),getDate()returnsnull(and the picker text falls back to the...placeholder) until the caller pins a new date or the user commits a selection through the popup.applyDefaultDateIfNeeded()now also runs when an explicitnullis present, so the popup wheels still open at a sensible default - the UX of "default seeds the popup" stays intact, only the leak intogetDate()is closed.setDateNullReEnablesDefaulttest codified the buggy behavior; replaced with two tests covering the original report (fresh picker +setDefaultDate+setDate(null)) and the prior-pinned-date variant. ThecancelOnFirstOpenKeepsPlaceholderAndDoesNotPinValue(Picker: default value is incorrectly set as new value when user taps Cancel (only on first use) #5014) test now assertsgetDate()returnsnullafter Cancel - same invariant ("staged default did not leak"), expressed in terms of the new semantics.Test plan
mvn -pl core-unittests test -Punittests -DunitTests -Dtest='PickerDefaultDateTest'- 12/12 pass, including the two new regression tests.mvn -pl core-unittests test -Punittests -DunitTests -Dtest='Picker*'- 31/31 pass across all Picker test classes.nullbefore the picker has been opened.🤖 Generated with Claude Code