3 ms·
Makes sense to cache an API call for prices, then if you don't realise you're mutating the cached object you could do this on every page load. Not in the web s
by IanCal 5y ago
Makes sense to cache an API call for prices, then if you don't realise you're mutating the cached object you could do this on every page load.
Not in the web space but I've seen similar with using pythons lrucache as using that on a function modifies the programs behaviour (if you mutate the returned value, you're in trouble).
- thayne 5y agoFor it to persist across refreshes you would need to do more than just mutate the object, you would need to actually write it back to a persisted location like localstorage or a cookie.
- IanCal 5y agoThat seems like the kind of assumption that could cause this kind of bug. I don't need to do that, just the layers under.
- staticassertion 5y agoI'm sure there are a billion frameworks that persist state automatically for you exactly like that.