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

New Sort Options #691

Merged
merged 10 commits into from
Nov 6, 2023
Merged

New Sort Options #691

merged 10 commits into from
Nov 6, 2023

Conversation

Sjmarf
Copy link
Member

@Sjmarf Sjmarf commented Oct 3, 2023

Adds five new sort options:

  • scaled
  • controversial
  • top 3 months
  • top 6 months
  • top 9 months

scaled and controversial are 0.19.0+ whilst the new top modes are available on the latest release version. The 0.19.0+ sort modes are hidden on instances that aren't running 0.19.0 or above.

Potential problem with this implementation:

You can still set the default sort mode to a mode that isn't available on your instance. If the user chooses an unsupported sort mode as the default, it would obviously be selected in the feed and they would see an error. I could filter out the modes that aren't available from the default sort-mode picker - this doesn't remove the problem though, because the user could set the default sort mode on a 1.19.0 instance and then switch accounts to an older instance, and they would still see an error.

Closes #673
Closes #321

Screenshot 2023-10-03 at 21 11 17

@Sjmarf Sjmarf requested a review from a team as a code owner October 3, 2023 20:04
@Sjmarf Sjmarf requested review from JakeShirley and EricBAndrews and removed request for a team October 3, 2023 20:04
@mormaer
Copy link
Contributor

mormaer commented Oct 3, 2023

scaled and controversial are 0.19.0+ whilst the new top modes are available on the latest release version. The 0.19.0+ sort modes are hidden on instances that aren't running 0.19.0 or above.

What version is the latest release version here? is it worth limiting the new top modes, the current instance list still shows a fair amount of instances on 0.18.1-0.18.3?

Potential problem with this implementation:

You can still set the default sort mode to a mode that isn't available on your instance. If the user chooses an unsupported sort mode as the default, it would obviously be selected in the feed and they would see an error. I could filter out the modes that aren't available from the default sort-mode picker - this doesn't remove the problem though, because the user could set the default sort mode on a 1.19.0 instance and then switch accounts to an older instance, and they would still see an error.

I think this is worth addressing, given it results in an empty feed with no clear reason why 😞 not quite sure what the best approach would be however as like you say right now it's globally set... I've thought of a horrible hack which I won't share out of shame 😂

We have a few weeks till this needs to be in so we can have a think of how to handle it... this will be a common problem going forward for other versioned values so we should try and come up with a nice solution that will solve it for future problems too 🙏

@Sjmarf
Copy link
Member Author

Sjmarf commented Oct 3, 2023

What version is the latest release version here? is it worth limiting the new top modes, the current instance list still shows a fair amount of instances on 0.18.1-0.18.3?

Couldn't remember when I was writing this, but I implemented a filter for it in my other sort-mode PR and it seems that they're new in 0.18.1. I can add a filter for it here, sure

@Sjmarf
Copy link
Member Author

Sjmarf commented Oct 3, 2023

We have a few weeks till this needs to be in so we can have a think of how to handle it... this will be a common problem going forward for other versioned values so we should try and come up with a nice solution that will solve it for future problems too 🙏

The best solution I can think of is to select the most similar sort mode to the default if the default is unavailable. Scaled would become hot, controversial would become most comments, etc. I'll think on it some more though

Copy link
Member

@EricBAndrews EricBAndrews left a comment

Choose a reason for hiding this comment

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

Code looks good--per Slack, let's go with offering a "fallback sort" option if the user selects a sorting option that is not supported by all instances.

@Sjmarf
Copy link
Member Author

Sjmarf commented Oct 19, 2023

Sure 👍

@Sjmarf
Copy link
Member Author

Sjmarf commented Oct 21, 2023

Done

Screenshot 2023-10-21 at 12 42 22

@Sjmarf Sjmarf requested a review from EricBAndrews October 23, 2023 20:31
Copy link
Member

@EricBAndrews EricBAndrews left a comment

Choose a reason for hiding this comment

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

Looks good! I really like moving sorting into its own menu section.

I noticed one bug around initializing the fallback state. When I first launch the app, it takes the default value and never the fallback. It works on subsequent loads--if I switch accounts or navigate back to the community menu and back into the feed it picks up the fallback, but it looks like the fallback is computed after the FeedView is already rendered and it does not reload on change.

Mlem/Views/Tabs/Feeds/Feed Root.swift Outdated Show resolved Hide resolved
Mlem/Extensions/View - Handle Lemmy Links.swift Outdated Show resolved Hide resolved
@Sjmarf
Copy link
Member Author

Sjmarf commented Nov 1, 2023

I noticed one bug around initializing the fallback state. When I first launch the app, it takes the default value and never the fallback. It works on subsequent loads--if I switch accounts or navigate back to the community menu and back into the feed it picks up the fallback, but it looks like the fallback is computed after the FeedView is already rendered and it does not reload on change.

So, I tried to fix it and now it works 90% of the time... but occasionally it just won't for some reason and I can't work out why :(

Copy link
Member

@EricBAndrews EricBAndrews left a comment

Choose a reason for hiding this comment

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

Commented a suggested fix for those 10% of cases where siteInformation doesn't properly trigger updates

Mlem/Views/Tabs/Feeds/Feed View.swift Outdated Show resolved Hide resolved
Mlem/Views/Tabs/Feeds/Feed View.swift Outdated Show resolved Hide resolved
Mlem/Views/Tabs/Feeds/Feed View.swift Outdated Show resolved Hide resolved
@Sjmarf
Copy link
Member Author

Sjmarf commented Nov 2, 2023

Thanks! Looks like it works consistently now.

@Sjmarf Sjmarf requested a review from EricBAndrews November 2, 2023 16:09
Copy link
Member

@EricBAndrews EricBAndrews left a comment

Choose a reason for hiding this comment

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

Nice 👍

@Sjmarf Sjmarf enabled auto-merge (squash) November 6, 2023 19:44
@Sjmarf Sjmarf disabled auto-merge November 6, 2023 19:44
@Sjmarf Sjmarf enabled auto-merge (squash) November 6, 2023 19:45
@Sjmarf Sjmarf merged commit 5f888cf into dev Nov 6, 2023
4 checks passed
@Sjmarf Sjmarf deleted the sjmarf/new-sort-modes branch November 6, 2023 20:00
boscojwho pushed a commit that referenced this pull request Nov 23, 2023
EricBAndrews added a commit that referenced this pull request Dec 18, 2023
Co-authored-by: Eric Andrews <[email protected]>
EricBAndrews added a commit that referenced this pull request Dec 18, 2023
Co-authored-by: Eric Andrews <[email protected]>
EricBAndrews added a commit that referenced this pull request Dec 18, 2023
Co-authored-by: Eric Andrews <[email protected]>
EricBAndrews added a commit that referenced this pull request Dec 18, 2023
Co-authored-by: Eric Andrews <[email protected]>
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.

[0.19.0] - Scaled sort option Add new sort options
3 participants