I'm new to WatermelonDB and am just getting it set up in my project.
I have a parent component called "UnsubscribeTab" which uses useObservables to listen to an observable, like so:
As you can see, that parent component renders a child component called "EnhancedEmailListItem". The definition of that child component is as follows:
The issue is that whenever React tries to render this child component for the first time, it throws the following error and none of the child components are rendered:
A few observations:
1) If I trigger any subsequent re-renders (by clicking around in my React web app UI, for example) the child component is able to render itself and the issue seems to be resolved. So this problem only seems to occur with the first render, before the child component is mounted.
2) Removing the following line from the child component completely fixes the issue:
messagesCount: sender?.messages?.observeCount(),
This seems to be an issue seems to happen when observeCount() is executed for the very first time.
Any ideas what might be happening here? I checked the docs for any mention of best practices for mounting, but wasn't able to find anything.
I'm new to WatermelonDB and am just getting it set up in my project.
I have a parent component called "UnsubscribeTab" which uses
useObservables
to listen to an observable, like so:As you can see, that parent component renders a child component called "EnhancedEmailListItem". The definition of that child component is as follows:
The issue is that whenever React tries to render this child component for the first time, it throws the following error and none of the child components are rendered:
A few observations:
1) If I trigger any subsequent re-renders (by clicking around in my React web app UI, for example) the child component is able to render itself and the issue seems to be resolved. So this problem only seems to occur with the first render, before the child component is mounted.
2) Removing the following line from the child component completely fixes the issue:
This seems to be an issue seems to happen when
observeCount()
is executed for the very first time.Any ideas what might be happening here? I checked the docs for any mention of best practices for mounting, but wasn't able to find anything.