When a new feed is added to a party, feed store immediately starts presenting messages from the feed via subscriptions, and hence to MessageFactory and then to models. Meanwhile, halo (I think, based on the code above), has to process some message or messages from the new feed (or perhaps from the feed of the greeter?) to have the full state needed by the downstream models (e.g. feed ownership).
Due to ... async... it is possible for these two code paths to be executed in the "inconvenient" order : messages get to models before halo understands about the feed's ownership.
We need a generic way to "interlock" processing such that messages aren't given to models until after all the other system components involved with feed processing (in this case halo) have given the go ahead. Some mechanism to: a) register with feed store(?correct) that "I'm a component that is involved with the message pipeline" and "until this promise is resolved you shouldn't process a new feed".
This code: https://github.com/dxos/sdk/blob/master/packages/client/src/client.js#L183 indicates a deeper problem:
When a new feed is added to a party, feed store immediately starts presenting messages from the feed via subscriptions, and hence to MessageFactory and then to models. Meanwhile, halo (I think, based on the code above), has to process some message or messages from the new feed (or perhaps from the feed of the greeter?) to have the full state needed by the downstream models (e.g. feed ownership).
Due to ... async... it is possible for these two code paths to be executed in the "inconvenient" order : messages get to models before halo understands about the feed's ownership.
We need a generic way to "interlock" processing such that messages aren't given to models until after all the other system components involved with feed processing (in this case halo) have given the go ahead. Some mechanism to: a) register with feed store(?correct) that "I'm a component that is involved with the message pipeline" and "until this promise is resolved you shouldn't process a new feed".