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

Rewrite in QML? #5

Open
szopin opened this issue Jun 16, 2023 · 4 comments
Open

Rewrite in QML? #5

szopin opened this issue Jun 16, 2023 · 4 comments

Comments

@szopin
Copy link

szopin commented Jun 16, 2023

There are so many little bugs, everytime you refresh you get different posts, comments are not loading properly, even after refresh half seem missing, would you oppose rewriting some of the app in pure QML (that allows me to work on an app on the bus etc). The nesting could be copied from SailSN (which is a poor man's quickditt copy), I'm sure we can find a way to get the posts in json format so maybe parts of sfv could be re-used too. Let me know what you think

@ilpianista
Copy link
Owner

Honestly? I would use that time to fix the little bugs instead.

If you want to send PRs or even fork SailHN go ahead, no problem from my side and we could even merge the fork once it's stable (if you wish).

@szopin
Copy link
Author

szopin commented Jun 20, 2023 via email

@ilpianista
Copy link
Owner

Sounds good! :-)

@szopin
Copy link
Author

szopin commented Aug 30, 2023

Heya, it took quite a while and a few approaches that failed (synchronous requests, worker scripts...) but I finally got something that works: https://github.com/szopin/harbour-SailHN/tree/master
Reworked the topstories to qml only (editing this in sfos browser on github was a pain as it ate all the CR/LFs, hope I didn't miss any) and then Story.qml is the meat, as it loads all comments and then sorts them to more or less the same order as they appear in browser. It takes ~8 seconds for 150 comment story on xperia XIII, which is not bad vs synchronous xhrs, of course the bigger comment trees will take longer but it seems to work good enough for 95% of stories. Let me know what you think and feel free to use any of the code (it's ugly but just to showcase functionality, sorting ends up being surprisingly quick about a secon for 1.5k comments)

edit: there is a small bug not sure how to tackle yet, 1-2 comments seem to not get moved properly, not sure if descendants are unreliable or my sorting is bit borked, but as the data is constantly changing and only some threads seem impacted... Annoying to debug
edit2: should be fixed now, dead and deleted comments were not counted by them, even though they were returned from api, the problematic threads now sort properly I think

edit3: apparently not all, I think the returned number of kids is also impacted by deads/deletes, resorted to calling the simple sort twice and seems to work reliably on the one thread previous broke (calling it once is enough but shorter branches get bumped then and the order of branches ends up upside down, calling it twice gives the more or less same ordering as on the webpage with longer branches closer to parent comment)

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

No branches or pull requests

2 participants