-
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugSomething that is not behaving is expected or prevents use entirelySomething that is not behaving is expected or prevents use entirely
Description
When switching to the next comic, a request for a new random comic gets made by the NavElement immediately when currentComic changes because it becomes a different request here:
client/src/components/NavElement/NavElement.tsx
Lines 65 to 74 in 41031da
| useRandomComicQuery( | |
| mode === NavElementMode.Present && settings?.showItemRandomButton | |
| ? { | |
| currentComic, | |
| itemId: item.id, | |
| skipGuest: settings.skipGuest, | |
| skipNonCanon: settings.skipNonCanon, | |
| } | |
| : skipToken | |
| ) |
This request happens before we even know if that item is going to be in the next comic, and so it might be a "wasted" request.
Potential solutions that I can think of are:
- Find a way to hold off on asking for a new random comic until all the data for the next comic has been loaded. This can be achieved through adding a new state value for
lastFullyLoadedComicIdor something, and using it for requesting a new random comic instead - Don't include the
currentComicin the request for a random comic at all, and instead re-request a random comic on the client side if the returned comic happens to be the same as the current one (avoiding this is currently handled server side which is why the current comic gets passed down). A potential problem here is that if the comic only appears in a single comic (the current one) this could lead to infinite looping if not handled carefully.
Metadata
Metadata
Assignees
Labels
bugSomething that is not behaving is expected or prevents use entirelySomething that is not behaving is expected or prevents use entirely