mirror of
https://github.com/stashapp/stash.git
synced 2026-01-03 22:24:41 +01:00
Fix graphql caching issues (#3973)
* Fix migrate infinite loop * Fix readDanglingNull
This commit is contained in:
parent
170f45c445
commit
2cf084130f
2 changed files with 7 additions and 14 deletions
|
|
@ -1975,16 +1975,7 @@ export const queryLogs = () =>
|
|||
fetchPolicy: "no-cache",
|
||||
});
|
||||
|
||||
export const useSystemStatus = () =>
|
||||
GQL.useSystemStatusQuery({
|
||||
fetchPolicy: "no-cache",
|
||||
});
|
||||
|
||||
export const querySystemStatus = () =>
|
||||
client.query<GQL.SystemStatusQuery>({
|
||||
query: GQL.SystemStatusDocument,
|
||||
fetchPolicy: "no-cache",
|
||||
});
|
||||
export const useSystemStatus = () => GQL.useSystemStatusQuery();
|
||||
|
||||
export const useJobsSubscribe = () => GQL.useJobsSubscribeSubscription();
|
||||
|
||||
|
|
|
|||
|
|
@ -27,10 +27,12 @@ const readReference = (typename: string): FieldReadFunction => {
|
|||
});
|
||||
};
|
||||
|
||||
// A read function that returns null if no valid reference is available.
|
||||
// A read function that returns null if a cached reference is invalid.
|
||||
// Means that a dangling reference implies the object was deleted.
|
||||
const readDanglingNull: FieldReadFunction = (existing, { canRead }) =>
|
||||
canRead(existing) ? existing : null;
|
||||
const readDanglingNull: FieldReadFunction = (existing, { canRead }) => {
|
||||
if (existing === undefined) return undefined;
|
||||
return canRead(existing) ? existing : null;
|
||||
};
|
||||
|
||||
const typePolicies: TypePolicies = {
|
||||
Query: {
|
||||
|
|
@ -60,7 +62,7 @@ const typePolicies: TypePolicies = {
|
|||
read: readReference("SavedFilter"),
|
||||
},
|
||||
findDefaultFilter: {
|
||||
read: readReference("SavedFilter"),
|
||||
read: readDanglingNull,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue