feat(cms): content not getting updated removed comments

This commit is contained in:
Amit Ranjan 2024-10-02 13:44:30 +05:30
parent adffbdaead
commit f8a6eb80ff

View File

@ -42,27 +42,12 @@ export const useUpdate = <
) => { ) => {
const api = useEntityApiClient<TAttr, TBasic, TFull>(entity); const api = useEntityApiClient<TAttr, TBasic, TFull>(entity);
const normalizeAndCache = useNormalizeAndCache<TBasic, string>(entity); const normalizeAndCache = useNormalizeAndCache<TBasic, string>(entity);
// const queryClient = useQueryClient();
// const { invalidate = true } = options || {};
return useMutation({ return useMutation({
mutationFn: async ({ id, params }) => { mutationFn: async ({ id, params }) => {
const data = await api.update(id, params); const data = await api.update(id, params);
const { entities, result } = normalizeAndCache(data); const { entities, result } = normalizeAndCache(data);
// if (invalidate) {
// queryClient.removeQueries({
// predicate: ({ queryKey }) => {
// const [qType, qEntity] = queryKey;
// return (
// (qType === QueryType.count || qType === QueryType.collection) &&
// isSameEntity(qEntity, entity)
// );
// },
// });
// }
return entities[entity]?.[result] as unknown as TBasic; return entities[entity]?.[result] as unknown as TBasic;
}, },
...options, ...options,