-
Notifications
You must be signed in to change notification settings - Fork 168
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
Transfer pagination work from frontend to backend #2787
Transfer pagination work from frontend to backend #2787
Conversation
… query appending method.
…efore dispatching
…nsTable component to allow for page reset upon application of filter
…e only 1 page's worth of entries.
…(OK), GradingStatus (tougher)
…on Table to use as filtering parameters.
This reverts part of daee139.
Fixes double API calls being dispatched on filter changes.
Removes unnecesary, slightly buggy logic
To optimize diff readability. Also updated the search placeholder value for UX.
…ct to override default functionality
… options dropdown to override filters by progress.
src/commons/sagas/RequestsSaga.ts
Outdated
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.
Previous behaviour:
if incompatible submissions filtering and ungraded only dropdown options were chosen, the submissions filtering option would override the dropdown. For example, given Filter status == "Attempting" and ungraded only dropdown value, the ungraded dropdown value is ignored, even if the expectations are 0 entries (because ungraded and status Attempting are mutually exclusive)
Current behaviour: dropdown options overrule filtering by progress status instead.
BUG: if mutually incompatible status + dropdown is introduced, 0 entries are shown to the user, but we still fetch by "Attempted" only. Our dropdown options now do frontend filtering!!! This must have something to do with Filters being stored as part of the workspace session (which you can verify if you select filters, go to another page, then go back). This is part of a larger bug (I will link here later to some bug report and enhancement i will be filing).
This bug does not occur for non-mutually exclusive intersections that play well together, like status==='Attempted' and viewing 'All': the backend still takes charge.
Time-intensive fix: Update logic so that Filters are no longer part of a Workspace state, which should kill off any remaining frontend filtering artifacts that this PR may not have removed.
Other fix possible: remove filter based on state of dropdown. setting 'viewing' to ungraded should remove progress filter (since viewing by ungraded implicitly requires all entries to have progress submitted.)
Fast fix: make progress non-Filterable.
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.
Thanks for catching this! I think it's an edge case, and I agree the filters should have not been stored in the state anyway (this was an oversight that was missed in the original PR). Regardless, it works for a normal use case so I think we can just leave it as a separate issue – this PR is getting large anyway.
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.
LGTM! Thanks for helping to review my changes @josh1248 !
Paired with backend PR: source-academy/backend#1065.
Description
This request shifts work of filtering from the frontend to the backend. Page state is converted into SQL offsets and limit for the backend, which stop querying once enough entries to fill the page is reached, hence saving time. State management by the grading submissions table state has been greatly reduced. Pagination work by tanstack has been removed.
Further polish to explore to extend this feature change:
Type of change
This is a breaking change:
It will diminish the functionality of the Grading Summary page as it can only read off the limited backend queries it gets.(Edit: no longer an issue as the grading summary page will be deletedFeature removals:
Feature enhancement: