yacs
yacs copied to clipboard
Too many requests when selecting course from the sidebar
Describe the bug When selecting a course in the sidebar, too many requests are made and there is a very noticeable slowdown. It also looks like there are more requests, the more sections a course has.
To Reproduce
- Select a couple of courses
- Open the sidebar
- Unselect and reselect a course (if you have your network tab open in your developer tools, you'll see there are a lot more requests than there should be)
Expected behavior Ideally, this should only make a single request
This is a result of the current implementation of SelectionService
calling addListing
on SidebarService
every time a section is added, which happens as part of a loop when toggleCourse
is called in SelectionService
. This should be easily hotfixable, though the refactored selection service will fix this issue as well.
See code: https://github.com/YACS-RCOS/yacs/blob/1376fb2024f90ad664239f343aee7628dea01d52/web/src/app/services/selection.service.ts#L77-L79
https://github.com/YACS-RCOS/yacs/blob/1376fb2024f90ad664239f343aee7628dea01d52/web/src/app/services/selection.service.ts#L54
alright great 👍 I'll keep this issue open of course until it is confirmed to be fixed. Glad this is being worked on.