yacs icon indicating copy to clipboard operation
yacs copied to clipboard

Too many requests when selecting course from the sidebar

Open Malorn44 opened this issue 5 years ago • 2 comments

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

Malorn44 avatar Apr 12 '19 15:04 Malorn44

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

LuminaSapphira avatar Apr 12 '19 15:04 LuminaSapphira

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

Malorn44 avatar Apr 12 '19 18:04 Malorn44