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",
|
fetchPolicy: "no-cache",
|
||||||
});
|
});
|
||||||
|
|
||||||
export const useSystemStatus = () =>
|
export const useSystemStatus = () => GQL.useSystemStatusQuery();
|
||||||
GQL.useSystemStatusQuery({
|
|
||||||
fetchPolicy: "no-cache",
|
|
||||||
});
|
|
||||||
|
|
||||||
export const querySystemStatus = () =>
|
|
||||||
client.query<GQL.SystemStatusQuery>({
|
|
||||||
query: GQL.SystemStatusDocument,
|
|
||||||
fetchPolicy: "no-cache",
|
|
||||||
});
|
|
||||||
|
|
||||||
export const useJobsSubscribe = () => GQL.useJobsSubscribeSubscription();
|
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.
|
// Means that a dangling reference implies the object was deleted.
|
||||||
const readDanglingNull: FieldReadFunction = (existing, { canRead }) =>
|
const readDanglingNull: FieldReadFunction = (existing, { canRead }) => {
|
||||||
canRead(existing) ? existing : null;
|
if (existing === undefined) return undefined;
|
||||||
|
return canRead(existing) ? existing : null;
|
||||||
|
};
|
||||||
|
|
||||||
const typePolicies: TypePolicies = {
|
const typePolicies: TypePolicies = {
|
||||||
Query: {
|
Query: {
|
||||||
@@ -60,7 +62,7 @@ const typePolicies: TypePolicies = {
|
|||||||
read: readReference("SavedFilter"),
|
read: readReference("SavedFilter"),
|
||||||
},
|
},
|
||||||
findDefaultFilter: {
|
findDefaultFilter: {
|
||||||
read: readReference("SavedFilter"),
|
read: readDanglingNull,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user