-
I'm not exactly sure how to title this so best to describe the issue. I have access to an endpoint that takes an input and returns an array. import { gql } from '@urql/core';
export const COLLECTION_FRAGMENT = gql`
fragment COLLECTION_FRAGMENT on CollectionItem {
collection_name
name
img
}
`;
export const GET_COLLECTION_FRAGMENT = gql`
query GET_COLLECTION_FRAGMENT($address: String!) {
walletCollections(address: $address) {
collections {
collection {
...COLLECTION_FRAGMENT
}
}
}
}
${COLLECTION_FRAGMENT}
`; So an Later, we want to create a unique list of collections across all wallets. Is there a recommended approach? I know I could pull each result in to app state and do the aggregation there but since it's already in cache I'm hoping to find a Thank you for any pointers! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Currently we don't really allow for "creating" a query that doesn't exist on your backend, so the best approach would be to have a query on your backend that corresponds to the data you need. |
Beta Was this translation helpful? Give feedback.
-
Just to expand on this a little; GraphQL is best used when it caters for the needs of your app. While it'd make sense to extend your schema and teach Graphcache about some tricks that your schema can do, the key is to always have a schema that can do the things that your apps need it to do. So the best approach here is to first implement this on the API-side. |
Beta Was this translation helpful? Give feedback.
Just to expand on this a little; GraphQL is best used when it caters for the needs of your app. While it'd make sense to extend your schema and teach Graphcache about some tricks that your schema can do, the key is to always have a schema that can do the things that your apps need it to do.
So the best approach here is to first implement this on the API-side.