Closed FrozenDude101 closed 2 months ago
Wonder why this is happening
The tickets are stored in a map so maybe there's a key clash, but I don't know why that would happen
Why are the tickets stored in a map, it would make more sense to be an array
So they can be updated in constant time
This is premature optimisation at its finest
It's future proofing
Actually, its just incorrect logic, surely when the time chages all the tickets need to be updated? So its linear anyway, as you need to go through them all, and iterating over an array is still linear
The tickets just store a price and whether they're single/return, changing the time shouldn't affect them
I meant for updating the delay repay Maps have marginal improvements here with adding/removing tickets, but lose out in generally representing the data how it is used But this whole conversation is pointless anyway for your users (me) use case
I use Array.from
a lot anyway to convert it to an array so I might actually be making it worse performant
I don't think it has anything to do with the map
Fixed by 678ef5d, having the functions in the useEffect dependencies (which is what I thought the React warning was telling me to but maybe not) caused useEffect to call infinitely
pun intended
Steps to reproduce:
Sometimes it adds the ticket after a significant delay.