mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Fix graphql caching issues (#3973)
* Fix migrate infinite loop * Fix readDanglingNull
This commit is contained in:
@@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user