-
Notifications
You must be signed in to change notification settings - Fork 188
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
Paginate topics #4616
Paginate topics #4616
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did first code read through and had a couple of comprehension questions, mostly because I'm lacking some context and familiarity with the code. I'll do a manual QA review and then a re-read of the code after that.
// A special table for logging unsynced changes | ||
// Dexie.js appears to have a table for this, | ||
// but it seems to squash and remove changes in ways | ||
// that I do not currently understand, so we engage | ||
// in somewhat duplicative behaviour instead. | ||
[CHANGES_TABLE]: 'rev++,[table+key],server_rev', | ||
[PAGINATION_TABLE]: 'queryString', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do i know this is supposed to be 'queryString'
? not rhetorical, just wondering what I should look into to understand the syntax/intention here. I did a quick repo search and didn't see anything similar. I can infer what's happening but just unfamiliar with the specifics of this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The string for each table is a comma separated list of indexed properties, with the first listed one being the primary key. As we are caching the results of paginated queries, the queryString should uniquely identify the request in question. Although perhaps, I should have called it 'queryURL' as I think that's more what I am using, I think (if I'm not, that's a good thing to pull me up on).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm, it does rather look like I forgot to add the table or API endpoint into this, so I'll need to update that (even though we are only currently paginating ContentNode).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have updated this now so that the primary key is a compound key of the table and the querystring, and updated the querying and saving accordingly too.
return collection.toArray(); | ||
} | ||
|
||
whereLiveQuery(params = {}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is liveQuery needed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not - I started trying to implement the pagination stuff using liveQuery to make sure it would be compatible, then realized I was doing more than was necessary for the immediate fix - then left these helper functions in here as generally useful, when I had originally intended to separate them out into a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left this in, because it does no harm, and it's useful tiny flyby refactor.
3ce1312
to
3813885
Compare
<template #pagination> | ||
<div class="pagination-container"> | ||
<KButton v-if="more" :disabled="moreLoading" @click="loadMore"> | ||
{{ 'Show more' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String on the lose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a dream that this was the case - it seems my dreams came true!
3813885
to
0cba194
Compare
…nating parent filtered queries.
…rating over a non-opaque cursor. Add some simple livequery methods to the resource layer.
0cba194
to
cf8d7b2
Compare
Not having luck trying to load more pages after clearing cache and all indexedDB, and I'm seeing some Sentry errors in the Network tab 😕 ![]() |
Ah yes, there's a bug here, that I've fixed in a follow up PR. |
Summary
Description of the change(s) you made
Manual verification steps performed
Make a topic with more than 50 children.
Check basic pagination works.
Clear cache and all indexedDB.
Load one additional page (so there should still be one more).
Reload the page.
Turn off the network connection in the network tab of the browser.
Press show more.
See that the additional page loads from indexedDB, and that even though there are no more nodes in IndexedDB, the cached pagination result allows 'show more' to still be shown.
Turn the network back on and press show more to see the remainder.
Screenshot
References
Fixes #1280
Comments
Contributor's Checklist
PR process:
CHANGELOG
label been added to this PR. Note: items with this label will be added to the CHANGELOG at a later timedocs
label has been added if this introduces a change that needs to be updated in the user docs?requirements.txt
files also included in this PRStudio-specifc:
notranslate
class been added to elements that shouldn't be translated by Google Chrome's automatic translation feature (e.g. icons, user-generated text)pages
,components
, andlayouts
directories as described in the docsTesting:
Reviewer's Checklist
This section is for reviewers to fill out.
yarn
andpip
)