Jacob Rhoda
09/19/2023, 9:43 PMStylianos Gakis
09/19/2023, 9:54 PM.fetchPolicy(FetchPolicy.CacheOnly).watch()
what you may be looking for? Unless I am misunderstanding what you mean here.Jacob Rhoda
09/19/2023, 9:58 PMStylianos Gakis
09/19/2023, 10:07 PMapolloClient.apolloStore.readFragment()
I assume right?
Might be a bit hacky, but could you use one of your queries which does return that type, so you can create a new query which just reads that fragment, and make it CacheOnly and it should just update when cache changes no? But maybe wait for someone who can help you better here 🤕Jacob Rhoda
09/20/2023, 1:28 AMmbonnin
09/20/2023, 8:46 AMmbonnin
09/20/2023, 8:49 AMfragment heroDetails on Hero {
id
name
friends(first: $first, after: $after) {
id
name
}
}
You can extend your query in a extra.graphqls
file next to your schema
extend type Query {
heroDetailsAccessor: Hero
}
Then you can write a query that reads your fragment:
query GetHeroDetails(first: String!, after: String!) {
heroDetailsAccessor {
...heroDetails
}
}
mbonnin
09/20/2023, 8:50 AMmbonnin
09/20/2023, 8:51 AMJacob Rhoda
09/20/2023, 2:17 PMmbonnin
09/20/2023, 2:29 PMfieldPolicy
to specify the id:
extend type Query @fieldPolicy(forField: "heroDetailsAccessor", keyArgs:"id") {
heroDetailsAccessor(id: ID!): Hero
}
mbonnin
09/20/2023, 2:29 PMid
in your query:
query GetHeroDetails(id: ID!, first: String!, after: String!) {
heroDetailsAccessor(id: $id) {
...heroDetails
}
}
mbonnin
09/20/2023, 2:31 PMJacob Rhoda
09/20/2023, 7:49 PMmbonnin
09/20/2023, 7:51 PMJacob Rhoda
09/20/2023, 7:51 PMJacob Rhoda
09/20/2023, 7:51 PMmbonnin
09/20/2023, 7:51 PMmbonnin
09/20/2023, 7:51 PMmbonnin
09/20/2023, 7:52 PMJacob Rhoda
09/20/2023, 7:57 PMJacob Rhoda
09/20/2023, 8:11 PMObject ‘QUERY_ROOT’ has no field named ‘fmisFieldRecordDataAccessor({“fieldRecordId”:“26b4bc5f-b338-42ac-8a6f-e4a9c09c5d95"})’
Jacob Rhoda
09/20/2023, 8:13 PMextend type Query @fieldPolicy(forField: "fmisFieldRecordDataAccessor", keyArgs: "id") {
fmisFieldRecordDataAccessor(fieldRecordId: ID!): FmisFieldRecord
}
Jacob Rhoda
09/20/2023, 8:14 PMquery GetFmisFieldRecordData($fieldRecordId: ID!) {
fmisFieldRecordDataAccessor(fieldRecordId: $fieldRecordId) {
...FmisFieldRecordData
}
}
Jacob Rhoda
09/20/2023, 8:21 PMmbonnin
09/20/2023, 9:21 PM