redlib icon indicating copy to clipboard operation
redlib copied to clipboard

🐛 Bug Report: Default post sort does not apply until settings are saved at least once

Open Sparronator9999 opened this issue 2 months ago • 1 comments

Describe the bug

When an instance (like my private one) is configured to sort posts (and possibly comments - I didn't test this) by anything other than the default (Hot for subreddit posts), the new setting doesn't take effect until the Settings page is opened and "Save" is clicked at least once (even if none of the settings were changed).

Steps to reproduce the bug

Steps to reproduce the behavior: 0. Configure your Redlib instance to sort posts by anything other than "Hot" (using REDLIB_DEFAULT_POST_SORT in my case), and restart it.

  1. Visit any subreddit through your instance (the default r/popular page is fine).
  2. Notice that posts are sorted by "Hot" instead of your default setting (I use "New" on my instance).
  3. Go to the settings page. Notice the default subreddit post sort is set to your new default.
  4. Click "Save" at the bottom of the page. No need to change any settings.
  5. Go back to the previous page and refresh (to apply settings "changes").

What's the expected behavior?

Subreddit posts will always be sorted by your instance's chosen default setting, even without saving any settings on the client end.

Additional context / screenshot

r/popular in a new browser session (all cookies/cache cleared):

Image

Relevant instance info, after showing the previous page:

Image

Relevant Redlib settings, after showing instance info:

Image
  • [x] I checked that the instance that this was reported on is running the latest git commit, or I can reproduce it locally on the latest git commit

Instance is running commit 2dc6b5f (latest as of writing).

Sparronator9999 avatar Nov 07 '25 07:11 Sparronator9999

Same issue here.

skywalkerwhack avatar Nov 12 '25 16:11 skywalkerwhack

Same issue here.

I have created a patch for this bug (in PR #521). Doing some further digging, the bug appears to have existed since configuration via environment variables was first introduced in this commit. Might explain why so many Redlib instances I used before I made my own seemingly had the default sort set to "Hot".

Sparronator9999 avatar Dec 16 '25 03:12 Sparronator9999