#Way to subscribe on child snapshot in a parent?

1 messages · Page 1 of 1 (latest)

misty wasp
#

Hi and happy holidays for everyone who celebrated it!

Is there a proper way to subscribe to the snapshot from a child from the parent when using spawn ? I'm already using

spawn(SearchShopifyResources, {
  id: "search-shopify-products",
  systemId: "search-shopify-products",
  syncSnapshot: true,
});

So the snapshot is in sync but is there an event or something to listen to perform an effect/action at each mutation of the child snapshot and remains managed by the parent (Without going to something that's not "controlled" by the parent machine (react scope for instance)) ? maybe something w/ fromObservable but I want to keep sending event to this child machine so I'm not sure what's the best pattern to do that

Thanks 🙏

icy plover
#

You'd get events under xstate.snapshot.search-shopify-products so you can listen to those events (might not be fully typed yet... sorry we're working on that)