updoot icon indicating copy to clipboard operation
updoot copied to clipboard

Add post shuffling

Open jrstrunk opened this issue 2 years ago • 0 comments

This pull request implements the features requested in #23 and #48. Buy adding a shuffle button to the top of the page that shuffles the currently displaying posts, feature request #48 is implemented. By allowing the user to adjust in the menu how many posts are shown after a shuffle, feature request #23 is implemented.

As an additional improvement, I add the ability to choose between using true randomness posts and unique randomness when shuffling a certain number of posts. True randomness shuffles the posts with a true random number generator, so each time the user presses the shuffle button, new random posts will appear. Unique randomness shuffles the posts using a seed so that it can guarantee that every time the user shuffles the posts, no post is shown twice before every other post in the set has been shown. This is nice when the user is shuffling many posts but only wants to see a few at a time so they do not keep getting repeats.

This pull request also adds some deferring to the post rendering. This is to provide the user with the first 100 posts immediately upon first page render and when changing settings that change the posts displayed. It is a simple solution, but if further performance optimizations need to be done later, the deferring logic is not hard to rip out and replace.

jrstrunk avatar Feb 08 '23 13:02 jrstrunk