Fix LoadingList::selected() to return item reference#114
Open
ryanoneill wants to merge 2 commits intomainfrom
Open
Fix LoadingList::selected() to return item reference#114ryanoneill wants to merge 2 commits intomainfrom
ryanoneill wants to merge 2 commits intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #114 +/- ##
=======================================
Coverage 92.64% 92.64%
=======================================
Files 100 100
Lines 9545 9547 +2
=======================================
+ Hits 8843 8845 +2
Misses 702 702 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Rename the old selected() -> Option<usize> to selected_index() and add a new selected() -> Option<&LoadingListItem<T>> for consistency with other Envision components (Tabs, RadioGroup) that return item references from their selected() method. - Rename selected() to selected_index() (returns Option<usize>) - Add selected() returning Option<&LoadingListItem<T>> - Make selected_item() an alias for selected() - Update all test call sites (~27) from selected() to selected_index() - Add test_selected_returns_item test Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
917afaa to
5e2f43f
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
selected()→selected_index()(returnsOption<usize>)selected()→Option<&LoadingListItem<T>>consistent with Tabs, RadioGroup patternselected_item()an alias forselected()selected()toselected_index()test_selected_returns_itemtestContext
Every other Envision component's
selected()returns an item reference (Option<&T>). LoadingList was the outlier, returningOption<usize>. The index-returning method is still available asselected_index().Test plan
selected())cargo clippy --all-targets --all-features -- -D warningsclean🤖 Generated with Claude Code