Replies: 1 comment 1 reply
-
I currently handle the offline state exactly like you do in I'm not sure yet about changing the behavior of |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been playing with the new
SyncManager
and I have to say I am enjoying it as it puts Signaldb almost on par with other similar libraries.In that time I noticed some possible areas of improvement. The main ones are network awareness and improvements around remote changes.
It would be nice if the
SyncManager
automatically paused sendingpush
requests when the device went offline and resumed via theonline
andoffline
window events. This is technically already possible but it's cumbersome as it involves throwing and catching errors inside the push & pull methods so the sync manager knows the sync failed and retries later.If you think this is out of scope, the sync manager could expose the
pause
andpauseAll
methods (opposite ofsync
andsyncAll
) and let the library user implement event listening and cleanup.Related to this is that it would be nice if the syncManager's
registerRemoteChange
changed how it executes. I believe it should be called for each collection as part ofsync
instead of once in the constructor. This way, it could also receive thecollectionOptions
(just likepush
andpull
) allowing each collection to connect to an entirely different source or use different configuration options.Also, the
registerRemoteChange
method should allow returning a cleanup function so we can gracefully shut down the remote data source and avoid memory leaks and other issues.If
registerRemoteChange
gets called for each collection onsync
and its cleanup function onpause
, then going offline and back online would be significantly simpler. It would be a matter of just callingpauseAll
andsyncAll
on theoffline
andonline
events respectively.Thanks for creating SignalDB @maxnowack
Beta Was this translation helpful? Give feedback.
All reactions