-
Notifications
You must be signed in to change notification settings - Fork 67
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
fix: merge course labels across pages #541
base: main
Are you sure you want to change the base?
fix: merge course labels across pages #541
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.
Please make sure that all checks are passing
…/ishita778/UT-Registration-Plus into fix/merge-same-course-pagination
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 current version will always remove the first row of a page (except for the first page, which doesn't go through the addRows function), because a header row has row.course === null
, which is true on the first iteration, and then each course object with non-null values have unique places in memory so !==
will always be true.
When you go to the page for unique numbers 00000-99999, you can see where this logic fails.
The first 2 removals of "the first header on the page" work because they happen to be the same as the previous label


However, for this example, the page boundary lies cleanly between two different courses, so this label should be preserved

despite the fact that it should be preserved, this PR deletes that label (it should be between 00875 and 00880

You'll need to query on the row.element
dom node if course === null to get the course title, then check it against the previous.
To preserve data across multiple calls to addRows
, you should use useRef
(https://stackoverflow.com/a/56456055/12101554) because you want to store state but you don't need it to trigger a rerender when you change lastCourse
.
Fixes #533
Before:

After:

example search URL: https://utdirect.utexas.edu/apps/registrar/course_schedule/20249/results/?ccyys=20249&search_type_main=FIELD&fos_fl=C+S&level=U&x=29&y=18
This change is