aplotor / expanse

selfhosted multi-user web app for externally storing Reddit items (saved, created, upvoted, downvoted, hidden) to bypass Reddit's 1000-item listing limits
GNU Affero General Public License v3.0
376 stars 16 forks source link

fix bugs and add new sorting functionality #17

Closed Mrwebente closed 2 years ago

Mrwebente commented 2 years ago

I wanted to improve on the current implementation and implement sorting by date ascending or descending. While testing my solution i noticed, that the list would fail to load if there are list elements with ids that begin with a number. This is because document.querySelector does not know how to handle this and throws an unhandled exception. If all ids in the current view contain a number at the first index, it will result in the list "buffering" indefinitely. It also prevented deletion of said list elements.

> document.querySelector(`#4r5fyd`)

> VM8380:1 Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '#4r5fyd' is not a valid selector.
    at <anonymous>:1:10

Feel free to give me suggestions for improvements of the new functionality.

I tested this implementation multiple times and have not found issues with it.

aplotor commented 2 years ago

can you separate this into 2 PRs ? also this seems to be a singular bug, not bugs, please name appropriately. so, one for the bug and one for adding option to sort asc. thank you

Mrwebente commented 2 years ago

can you separate this into 2 PRs ? also this seems to be a singular bug, not bugs, please name appropriately. so, one for the bug and one for adding option to sort asc. thank you

Will separate it, It is actually causing two bugs though, preventing deletion, and preventing loading of elements under certain circumstances. It's just that the cause of the bugs is the same.

aplotor commented 2 years ago

it is one bug causing multiple other bugs, i suspect there may be more than 2 things that dont work client-side after this bug occurs. it's a technicality, but i would consider this one bug. e.g., if a bug causes the entire app to not start, then there would be infinite bugs according to your definition

Mrwebente commented 2 years ago

it is one bug causing multiple other bugs, i suspect there may be more than 2 things that dont work client-side after this bug occurs. it's a technicality, but i would consider this one bug. e.g., if a bug causes the entire app to not start, then there would be infinite bugs according to your definition

Sorry if the description was not clear enough. What i'm describing as unable to delete element is not dependent on the page not loading, it's a completely separate instance of the same Problem that occurs at a different place and time. Obviously you cannot delete elements that don't load, in fact there isn't even a way to try. It's at a separate place it's a different function, and if i didn't know that the root cause is the same for both, i would have reported two separate bugs. One doesn't influence the other occuring as such. You could happily click away trying to delete entries that were loaded and displayed correctly, but they wouldn't disappear.