Fix cache management (#2264)

This commit is contained in:
martmull
2023-10-27 18:20:11 +02:00
committed by GitHub
parent acbcd2f162
commit 35237c05f3
11 changed files with 85 additions and 32 deletions

View File

@ -4,7 +4,9 @@ export const INSERT_ONE_API_KEY = gql`
mutation InsertOneApiKey($data: ApiKeyCreateInput!) {
createOneApiKey(data: $data) {
id
name
token
createdAt
expiresAt
}
}

View File

@ -0,0 +1,17 @@
import { GET_API_KEYS } from '@/settings/developers/graphql/queries/getApiKeys';
import { ApiKey } from '~/generated/graphql';
export const getApiKeysOptimisticEffectDefinition = {
key: 'generic-entity-table-data-api-keys',
typename: 'ApiKey',
query: GET_API_KEYS,
resolver: ({
currentData,
newData,
}: {
currentData: ApiKey[];
newData: ApiKey[];
}) => {
return [...newData, ...currentData];
},
};