Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is current injection of GraphQLClient and RootStore okay? #23

Open
KashubaK opened this issue Feb 19, 2023 · 1 comment
Open

Is current injection of GraphQLClient and RootStore okay? #23

KashubaK opened this issue Feb 19, 2023 · 1 comment
Labels
question Further information is requested

Comments

@KashubaK
Copy link
Collaborator

The generated rootStore.ts file stores singletons of the RootStore and GraphQLClient, and provides the following functions to access them: getRootStore, getGraphQLClient, setGraphQLClient.

The singletons are not exported themselves. The only way to access them is through those functions. This was done as I believe it would be easier to mock the functions within a test environment as opposed to mocking the singletons.

What are the drawbacks of using this method of injection? What are some convenient ways to improve this (if any?)

@KashubaK KashubaK added the question Further information is requested label Feb 19, 2023
@Kashuab
Copy link
Owner

Kashuab commented Mar 25, 2023

Update on this, Query and Mutation classes no longer directly depend on the RootStore. Rather, the new DepotGQLClient handles calling RootStore.resolve instead. This is more ideal as there's now only one thing that really depends on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants