Conversation
…format
The direction_select was using a list of dictionaries with 'label' and 'value'
keys, which is Quasar's format but not supported directly by NiceGUI. This caused
a ValueError: Invalid value: desc because NiceGUI wraps these options differently,
making the value 'desc' not match any valid option.
Changed to NiceGUI's proper dictionary format where keys are values and values
are labels: {'desc': 'Descending', 'asc': 'Ascending'}. This eliminates the need
for emit-value and map-options props.
Fixes the search dialog failing to open with ValueError.
There was a problem hiding this comment.
Pull Request Overview
This PR simplifies the direction_select UI component in the HuggingFace search dialog by refactoring its options format and removing unnecessary Quasar props.
- Changed the direction select options from a list of dictionaries to a simpler dictionary format
- Removed the
.props('emit-value map-options')call that is no longer needed with the dictionary format
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| {'label': 'Descending', 'value': 'desc'}, | ||
| {'label': 'Ascending', 'value': 'asc'} | ||
| ], | ||
| options={'desc': 'Descending', 'asc': 'Ascending'}, |
There was a problem hiding this comment.
The dictionary keys and values are swapped compared to the typical NiceGUI pattern. With the new dictionary format {'desc': 'Descending', 'asc': 'Ascending'}, the keys ('desc', 'asc') are used as values and the dict values ('Descending', 'Ascending') are used as labels. When accessing self.direction_select.value on line 106, it will now correctly return the string keys ('desc' or 'asc'), which matches the expected behavior. However, this is the opposite pattern from the removed code where emit-value was needed. Consider verifying this works as expected with the rest of the codebase, particularly line 106 where direction_str = str(self.direction_select.value) expects 'desc' or 'asc' as values.
|
Automated review 🤖 Summary of Changes Key Changes & Positives
Potential Issues & Recommendations
Language/Framework Checks
Security & Privacy
Build/CI & Ops
Tests
Approval Recommendation
|
…format
The direction_select was using a list of dictionaries with 'label' and 'value' keys, which is Quasar's format but not supported directly by NiceGUI. This caused a ValueError: Invalid value: desc because NiceGUI wraps these options differently, making the value 'desc' not match any valid option.
Changed to NiceGUI's proper dictionary format where keys are values and values are labels: {'desc': 'Descending', 'asc': 'Ascending'}. This eliminates the need for emit-value and map-options props.
Fixes the search dialog failing to open with ValueError.