Open kejistan opened 2 years ago
@kassens Do we have any internal docs we could share here?
This isn't documented yet, because it's still in an experimental phase internally.
What you can already do today is creating multiple Environment
s and use them on one page (using ReactContext rules, so the innermost EnvironmentProvider is used in a React tree.
The core that multi-actor supports is that a single GraphQL response could return data for multiple data "viewers". Example, on a feed when you admin/control multiple accounts, multi-actor might support fetching a single GraphQL query where posts from each account you control might be returned with the "viewer" permissions of that account.
This is pretty advanced, I suspect you might be looking for a different feature.
We sometimes experiment with new features where we're not sure they'll make it into a stable API. This is one such example that's been stalled development internally unfortunately.
That is actually quite similar to the problem that led me to finding the multi-actor code. Specifically: issuing a request that resolves part of the response with a different set of permissions on the backend, and then wanting a mechanism to write those results to a different environment's store. The current scheme I'm using is as you describe, manually managing multiple environments, changing them in the context, and manually copying data to the other environment's store via commitLocalUpdate
.
Unfortunate to hear that it has stalled, but totally understand that it is a niche feature.
This is a neat part of relay that got built out last year, but it still hasn't been documented anywhere. Can we write some documentation about how and when to use this?