When all same amount of time, one expire at a time: 3rd one expires, first one SOMETIMES restarts timer and then also expires, else both 1st and 2nd just sit there with timers ran out.
Most likely due to nextCakeToDisplay is one cake and not an array (cannot handle many expiring at the same time)
When different amounts of time based on # cake layers, if 3,3,2 - 2 expires before it fully reaches timer bar end?
setup:
implemented different lengths of timers based on number of cake layers and order card expiry with the passed down prop func in a useEffect
so each layer adds 10s to the timer, i.e. 1 layer cakes are given 10s and 3 layers are 30s
hardcoded the generated cake cues to be this just to see different timers:
symptoms:
when order 1 expires at 10 s, it vanishes and order 4 replenishes at the end of the queue; this is right
when order 2 expires at 20s, order 1 reappears at the beginning with a full timer?
when the revived order 1 and order 3 expire at the same time at 30s, order 3's timer is refilled again to the max and order 5 appears to take order 1's place as it expires as normal
when order 4 expires, it revives order 2
investigation:
console.logged the cakesToDisplay array, the newly expired order card, and the order id that is queued to be the nextCake to display to see what is happening:
it looks like the array of 3 to display is not being created properly?
thoughts:
maybe nextCakeToDisplay should be an array instead of a single cake? not sure if it matters in theory because each expired card should call a next one in a 1:1 way, but esp before i hardcoded the cakes, there were a lot of instances of randomly generated cakes all expiring at the same time because the have the same number of layers and it seemed to confuse the program the way it is right now?
not sure if i should be handling this stuff more in the backend to avoid whatever this issue is, like maybe it would be easier if i have a property called "alreadyExpired/Submitted" and filtered the cakesArray for just whatever cakes are still eligible to be displayed, instead of trying to track ids in the front end?
When all same amount of time, one expire at a time: 3rd one expires, first one SOMETIMES restarts timer and then also expires, else both 1st and 2nd just sit there with timers ran out.
Most likely due to
nextCakeToDisplay
is one cake and not an array (cannot handle many expiring at the same time)When different amounts of time based on # cake layers, if 3,3,2 - 2 expires before it fully reaches timer bar end?
setup:
symptoms:
investigation:
console.logged the cakesToDisplay array, the newly expired order card, and the order id that is queued to be the nextCake to display to see what is happening:
it looks like the array of 3 to display is not being created properly?
thoughts: