You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
Apollo is excellent to work with business logic on the server. But, I'm facing some blocker questions on how to do simple business logic on the client because the only provided method I could find to query apollo store is the graphql wrapper injection of props.
What's the problem I'm facing?
In my reducers I need to have access to data queried by apollo, because they are needed to fulfil that action's purpose. I'm not gonna change apollo's store, because it's clear to me it should not be done. But, I need to use the data that is in there to be able to make some calculations and change my app's store.
Should I query apollo's store and just grab data from there? It feels to me that this could break some contracts. It's clear that apollo has a nice way to query this data and return it in a structured (denormalized) format.
Are there methods available to query apollo's store? I fell that graphql-anywhere is probably a good tool for that, but I could not find how to query the store using it. I also think that we should be able to get the exact query result at that place (inside a reducer) and receive the same structure that is injected by the graphql wrapper.
The structured data injected in the component is excellent for rendering purposes, but I also need this data on the reducers. Today as this data is only available inside components, it kink of imposes a bad pattern (IMHO) that is to keep business logic in there.
So, this are my concerns. I'd like to hear the solutions and options available to do this.
Apollo is excellent to work with business logic on the server. But, I'm facing some blocker questions on how to do simple business logic on the client because the only provided method I could find to query apollo store is the graphql wrapper injection of props.
What's the problem I'm facing?
In my reducers I need to have access to data queried by apollo, because they are needed to fulfil that action's purpose. I'm not gonna change apollo's store, because it's clear to me it should not be done. But, I need to use the data that is in there to be able to make some calculations and change my app's store.
Should I query apollo's store and just grab data from there? It feels to me that this could break some contracts. It's clear that apollo has a nice way to query this data and return it in a structured (denormalized) format.
Are there methods available to query apollo's store? I fell that graphql-anywhere is probably a good tool for that, but I could not find how to query the store using it. I also think that we should be able to get the exact query result at that place (inside a reducer) and receive the same structure that is injected by the graphql wrapper.
The structured data injected in the component is excellent for rendering purposes, but I also need this data on the reducers. Today as this data is only available inside components, it kink of imposes a bad pattern (IMHO) that is to keep business logic in there.
So, this are my concerns. I'd like to hear the solutions and options available to do this.
After that, I can come up with a PR on the docs (here I guess:http://dev.apollodata.com/react/redux.html) with the result of this discussion.
The text was updated successfully, but these errors were encountered: