codeparty/racer — pull request #76 by SLaks (2013-02-12 23:55:22+00:00)
Title: Don't update queries until after model refresh

See https://groups.google.com/forum/?fromgroups=#!topic/derbyjs/GJ9FCqgyQGk

>Whenever the server sends snapshotUpdate:replace, Racer (on the client) clears all persistent parts of the model, then rebuilds them from the server update.
>This triggers set events for each object in every collection, which then triggers more set events on every query that is (indirectly) based on the collection (through listenerQueryMutator).
>The problem is that the original subscription query never clears its resultIds (_$queries._2.resultIds).
>Therefore, when the listenerQueryMutator for the nested query calls scopedModel.get() (in order to update the results of the in-memory query), it tries to resolve the refList for the subscribed query, which at this point refers to non-existent documents. (because the collection is still being populated)

I have not tested this thoroughly