SwampScheduler icon indicating copy to clipboard operation
SwampScheduler copied to clipboard

Cache fetched courses

Open hieunguyent12 opened this issue 2 years ago • 3 comments

In reference to Robert's comment https://github.com/ufosc/SwampScheduler/pull/26#discussion_r1320936890.

Expected behavior: When the user searches "MAC", all math courses are fetched like MAC2312, MAC2313, MAC1105, etc... What we want to do is cache all of these courses (I believe this is already the default behavior for React Query), so when the user queries a specific math course like MAC2312, we will fetch from the cache to get information for that specific course instead of refetching the API.

We can also fetch that course in the background and then update the cache with the latest information.

hieunguyent12 avatar Sep 20 '23 03:09 hieunguyent12

Can I claim this issue?

elicampos avatar Jan 30 '24 04:01 elicampos

Yes, go ahead! I never really made any progress on this.

hieunguyent12 avatar Jan 30 '24 05:01 hieunguyent12

Hello! I managed to get it working under a new branch but for some reason it's not giving me permission to push. I tried doing it on Linux and Windows. I implemented a system in which it caches the searches and the individuals courses. So if you search something that was previously searched, it will still pull from the cache(Basic React Query which you guys already had), however during this process it also caches each course found. So now for each course search, it sees if the result was a search or course and if neither it calls the API again. The only drawback to this is the fact that very large searches like "EEL" for example, take about 30% longer, as it's caching all the courses but again now every course with EEL pops up almost instantly.

elicampos avatar Feb 09 '24 06:02 elicampos