Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!(llc, core): Improve query sorts and provide defaults. #2188

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xsahil03x
Copy link
Member

Description of the pull request

This pull request aims to redesign sorting to be type-safe with IDE assistance. The new system uses ComparableField to handle comparison between different value types and introduces extension types like UserSortKey and ChannelSortKey for better discoverability. This ensures the same sorting logic works client-side and server-side while catching errors at compile-time instead of runtime.

@xsahil03x xsahil03x linked an issue Apr 7, 2025 that may be closed by this pull request
1 task
///
/// Classes that implement this mixin can be used in sorting operations
/// where the sort key is determined at runtime.
mixin ComparableFieldProvider {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just make this an abstract interface class, because a mixin usually has functionality and not just an interface. A mixin you also use with with, for example class Musician extends Performer with Musical, but in our code it's always used with implements, so just as an interface.

Suggested change
mixin ComparableFieldProvider {
abstract interface class ComparableFieldProvider {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you extract all the sorting logic out of requests.dart? For example sort_option.dart. The file is getting quite big and this is now not only usable for requests, but also in other parts of the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom sort function for StreamChannelListView
2 participants