Closed gawlster closed 1 year ago
@gawlster I think you're on the right track overall.
useTerm
hook and hard coding it could uncover something.will close this ticket for now as PR #486 rolled back the useTerm
changes and it now seems to be working
feel free to open it up again if not!
Describe the Bug/Issue The booklist page ends up in an infinite loop. There are two cases here:
These are my thoughts after a quick investigation (take these with a grain of salt as I have never contributed to this repo):
Something is wrong with![image](https://github.com/VikeLabs/courseup/assets/65568579/d782bdaa-a550-4e7f-8330-c221eb09d0e1)
useTextbooks
. It seems to never respond successfully. I've only seen 404s. Probably check this out and run some tests to make sure data is being returned properly.There is a side-effect somewhere caused by the
useTextbooks
hook which forces a full re-render, and I think it has something to do with thePage
component. Since the fetch for textbook data happens on mount, this is what is causing the infinite fetch. This is how I tested my hypothesis:This is basically the BooklistContainer component which has the infinite fetch issue.
Replacing it with the following obviously just shows a blank screen, but the fetch only happens once (well, twice locally because of strict mode but it would be once in prod):
I can also block the infinite fetch with a ref inside
useTextbooks
, but this still runs into infinite exceptions:Point being, it will take a bit of investigation but hopefully I was able to point you in a decent direction.
To Reproduce Steps to reproduce the behaviour/bug/issue:
Expected Behaviour Should work lol
Desktop/Mobile
Additional Context I'm happy to look into this further later this week