2 ms·
Pretty easy - component that stores a redux computed value and a setTimeout that calls an action with the value. If the settimeout (or a websocket event, etc)
by mosdl 7y ago
Pretty easy - component that stores a redux computed value and a setTimeout that calls an action with the value. If the settimeout (or a websocket event, etc) fires before the batched update, you are out of sync.
Most people have simple applications so redux works fine, but once you get complicated async work things just break down.
- acemarke 7y agotbh that doesn't sound like a Redux-specific problem. That sounds like a general async / stale-references problem. If you've captured a value and try to use it later, then yeah, you're probably going not going to be using the latest version.
- mosdl 7y agoWhich is a design flaw of redux. Proper systems allow you to access the current state value at all times, without having to worry about batching.