useObservableState: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render. #55
Replies: 6 comments 7 replies
-
it seems that if i make the above code into a epic like hook, the problem isn't present. @crimx would you be willing to explain why this is the case if you know the reason? thanks 🙏🏾
|
Beta Was this translation helpful? Give feedback.
-
See here.
|
Beta Was this translation helpful? Give feedback.
-
If you don't wrap observable creation or operations in a function then every time the component re-renders, a new observable is created and observable-hooks will switch to the new observable instead. |
Beta Was this translation helpful? Give feedback.
-
Thank you! Makes sense! |
Beta Was this translation helpful? Give feedback.
-
Maybe this should be in the q&a @crimx |
Beta Was this translation helpful? Give feedback.
-
@crimx why don't you do this internally in |
Beta Was this translation helpful? Give feedback.
-
I have an observable like below. its using an observable called period (created by
useObservable(new BehaviourSubject())
). I seem to get this issue, even when I'm not doing anything with the outputdata
.period subject isn't used to render anything else, I've commented out everything..
any thoughts on ideas on this? is this a bug?
attached is the call stack
Beta Was this translation helpful? Give feedback.
All reactions