Skip to content

Commit

Permalink
Don't cache null projects
Browse files Browse the repository at this point in the history
  • Loading branch information
myieye committed Oct 3, 2024
1 parent 4900934 commit acdc600
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions frontend/src/lib/gql/gql-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ function createGqlClient(_gqlEndpoint?: string): Client {
'FlexProjectMetadata': (metaData) => metaData.projectId as string,
},
updates: {
Query: {
'projectByCode': (result, args, cache) => {
if (result.projectByCode === null) {
// Don't cache null project results
cache.invalidate('Query', 'projectByCode', args);
}
},
},
Mutation: {
createProject: (result: CreateProjectMutation, args: CreateProjectMutationVariables, cache, _info) => {
if (args.input.orgId) {
Expand Down

0 comments on commit acdc600

Please sign in to comment.