Closed aboodman closed 12 months ago
What would the optional argument do?
I think at the time I was thinking it would be "right now" vs "soon". But I guess that's not needed since by default we push soon.
I am tracking online and visibility state to replicache.pull()
as soon UI is online or gets focus (ie. changed tap from background to foreground).
/**
* tracks changes on visibilitychange
*/
document.addEventListener('visibilitychange', () => {
if (document.visibilityState === 'visible') replicache.pull()
})
/**
* tracks changes on network events
*/
const online = useOnline()
watch(online, (isOnline) => {
if (isOnline) replicache.pull()
})
so for a user all remote changes get pulled instantly. Same would apply for replicache.push()
to propagate local changes. Waiting a couple of seconds is often confusing users.
This has been implemented in 14.0.3: https://replicache.notion.site/Replicache-14-0-3-3dce462db565425c846875b488677c07?pvs=4
Sometimes users want to push asap, no rate-limiting, no nothing (ie, if they are going to send some other rest request to their server and do something with data).
They also want to know when all pending mutations have been sent.
It would be nice to have a push() method for this purpose, perhaps with an optional
now
argument. We could makepull()
match.