Make fetch async
PerWiklander opened this issue · comments
I sometimes get this message in the console when using PotMap
:
Warning: DiodeWrapper is accessing isMounted inside its render() function.
render() should be a pure function of props and state. It should never
access something that requires stale data from the previous render,
such as refs. Move this logic to componentDidMount and componentDidUpdate instead.
It looks like the problem is that the mapHandler
in AsyncActionRetriable
wants to set the value of the Pot
to Pending
right away. If this happens while rendering, React gets cranky.
This is due to PotMap
calling fetcher synchronously, which updates the model and causes a chain of calls that result in a call to isMounted
in the ReactConnector
. I'll update PotMap
to always call fetcher in an async fashion to avoid this (and other potential related problems).
Fixed in ece23b6