Closed bratelefant closed 11 months ago
@bratelefant is there something I can do here to help out?
Actually I'm really not sure weather this is a feature / behavior that is really requested or accepted. That's why I added this as a draft, as sort of a basis for discussion.
Also, I suppose we need a better way to determine the point when the initial additions of documents are finished to remove stale data; usage of setTimeout
is kind of messy.
Closing this PR due to no activity. Feel free to reopen.
If there's a (re)connect, then all docs are removed completely and then readded via initial ddp
added
events. This can result in flashing ui, since items disappear and then reappear after being readded.I guess this was considered necessary, since during the time with no connection to the server, there may be docs that get removed from the db, and the somehow the client needs to get those docs removed aswell as soon as it is reconnected.
This PR solves this by marking all docs as
_stale
on a disconnect. After a reconnect, docs will get initially added via ddp, and will be flagged as not being_stale
anymore.After a certain timeout following a (re)connect (bet there's a better place to do this? if all subs are ready maybe?), all docs, that were removed on the server are still flagged as
_stale
. Now all_stale
docs can be safely removed from the client.Also adds the
skipUpdate
callback to theuseTracker
hook, as known from react-meteor-data.