YACS-RCOS / yacs

Yacs - The Scheduler for Everyone
https://yacs.io
GNU Affero General Public License v3.0
69 stars 58 forks source link

Too many requests when selecting course from the sidebar #443

Open Malorn44 opened 5 years ago

Malorn44 commented 5 years ago

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

  1. Select a couple of courses
  2. Open the sidebar
  3. 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

LuminaSapphira commented 5 years ago

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

Malorn44 commented 5 years ago

alright great 👍 I'll keep this issue open of course until it is confirmed to be fixed. Glad this is being worked on.