S.
10/20/2024, 9:14 PMS.
10/20/2024, 9:17 PMObject 'UserCardsPayload:{field=CreatedAt, order=Desc}' not found
type Query {
user: User
}
type User {
cards(afterId: UUID, language: String, limit: Int, search: String, sortBy: CardSortingInput): UserCardsPayload!
decks(afterId: UUID, limit: Int, sortBy: DeckSortingInput, tags: [String!], title: String): UserDecksPayload!
}
type UserCardsPayload {
cards: [Card!]
errors: [AccessError!]!
hasNext: Boolean!
}
type UserDecksPayload {
decks: [Deck!]
errors: [AccessError!]!
hasNext: Boolean!
}
query Collection {
user {
decks {
decks {
...DeckItem
}
hasNext
}
cards(sortBy: {field: CreatedAt, order: Desc}) {
cards {
...CardItem
}
hasNext
}
}
}
extend type User @fieldPolicy(forField: "decks", keyArgs: "afterId sortBy tags title")
extend type User @fieldPolicy(forField: "cards", keyArgs: "afterId sortBy search language")
extend type Deck @typePolicy(keyFields: "id")
extend type Card @typePolicy(keyFields: "id")
extend type User @typePolicy(keyFields: "id")
S.
10/20/2024, 9:19 PMuser.decks
works and would get retrieved from the cache but user.cards(sortBy: {...})
cannot be found with the log on topS.
10/20/2024, 9:21 PMS.
10/20/2024, 9:23 PMObject 'UserCardsPayload:{field=CreatedAt, order=Desc}' not found
since it's supposed to be a fieldPolicy to user.cards
, is it trying to find the payload class as if there was a typePolicy set or is this just what the logs look like?bod
10/21/2024, 9:14 AMUserCardsPayload
that matches the fieldPolicy for user.cards (of type UserCardsPayload
) - otherwise the generated cache ids will be different when writing to vs when reading from the cache, which results in the cache miss.
But in your case, you can't really do that, since the arguments have no equivalents in the return's type fields.
You should probably remove these fieldPolicies and the default cache id (uses the path) will be used.S.
10/21/2024, 9:57 AMS.
10/21/2024, 9:58 AMpaginationArgs
for fieldPolicies? it says they're omitted for computing the cache key?bod
10/21/2024, 10:00 AMS.
10/21/2024, 10:26 AMextend type User @fieldPolicy(forField: "cards", paginationArgs: "afterId")
bod
10/21/2024, 10:29 AMApolloStore
or with the incubating lib)S.
10/21/2024, 10:30 AMS.
10/21/2024, 10:32 AMbod
10/21/2024, 10:34 AMS.
10/21/2024, 10:38 AMbod
10/21/2024, 10:40 AM