Comment update system #4

Closed
opened 2022-03-25 14:18:17 +01:00 by DutchEllie · 2 comments
Owner

Rather than always getting the comment data from the server and then rendering it. Load the comments once and save that (possibly base64 encoded) in the browser's localstorage. Then once the page is loaded again use the localstorage first to quickly load all the comments while you're also loading new comments from the API.

If the new loaded comments are different from the old ones, update the field. Otherwise you can leave it alone.

Possibly even better, instead of loading all the comments and checking if there is an update, the API might expose a hash. This hash is the hash of the entire comment DB. If this hash is different, then load all the comments.

This saves more on database queries.

Rather than always getting the comment data from the server and then rendering it. Load the comments once and save that (possibly base64 encoded) in the browser's localstorage. Then once the page is loaded again use the localstorage first to quickly load all the comments while you're also loading new comments from the API. If the new loaded comments are different from the old ones, update the field. Otherwise you can leave it alone. Possibly even better, instead of loading all the comments and checking if there is an update, the API might expose a hash. This hash is the hash of the entire comment DB. If this hash is different, then load all the comments. This saves more on database queries.
Author
Owner

Commit in api has made this possible.

[Commit in api](https://dutchellie.nl/DutchEllie/proper-website-api/commit/f54a7434882a6916c59bfa922fdfbf5baa56211d) has made this possible.
Author
Owner

Done!

Done!
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: DutchEllie/proper-website-2#4
No description provided.