Description
This looks very similar to #35, but that was marked fixed in 2019.
For slow queries and fast UI changes it is possible for either the wrong result to be displayed or "state update on an unmounted component" warnings to be shown.
This seems to be caused by the async state update in the *Once method useEffects. setValue
is called asynchronously and if the get
responses are returned out of order, the value state will be set to the wrong result. It can also trigger an invalid call after a component is unmounted.
get(ref.current).then(setValue).catch(setError);
A possible solution would be to have these listen==false
branches return a cleanup which would cause the get
response to be ignored. A work around is switching to using the non-*Once methods.