WatermelonDB
WatermelonDB copied to clipboard
Is there a way to pause/stop withObservables()
Is there a way to pause/stop withObservable()
?
Why? When working with react-navigation
, the screen does not get unmounted, which means the withObservable()
keeps on running, even if the screen is not focussed anymore. Assuming there are five or six screens connected to a rather large table, this would result in performance issue because all the screens would continiously read from the database (if there are changes), eventhough the screen is not in focus.
Use withObserve in child components of the screen. When blurring the screen replace those components with placeholders. Restore on focus.
Edit: as temp solution like i use
@ChrisSimoniMBT thanks. That sounds like a reasonable workaround. Do you know if the withObservables()
also run, when the app went to the background?
is there any permanent solution for this?