tangled
alpha
login
or
join now
cosmik.network
/
semble
43
fork
atom
A social knowledge tool for researchers built on ATProto
43
fork
atom
overview
issues
13
pulls
pipelines
fix: cache invalidation on note update
Pouria Delfanazari
4 months ago
ef58f4b3
adcb8ae0
+8
-1
2 changed files
expand all
collapse all
unified
split
src
webapp
features
cards
lib
mutations
useRemoveCardFromLibrary.tsx
notes
lib
mutations
useUpdateNote.tsx
+2
src/webapp/features/cards/lib/mutations/useRemoveCardFromLibrary.tsx
···
2
2
import { removeCardFromLibrary } from '../dal';
3
3
import { cardKeys } from '../cardKeys';
4
4
import { collectionKeys } from '@/features/collections/lib/collectionKeys';
5
5
+
import { noteKeys } from '@/features/notes/lib/noteKeys';
5
6
6
7
export default function useRemoveCardFromLibrary() {
7
8
const queryClient = useQueryClient();
···
13
14
14
15
onSuccess: () => {
15
16
queryClient.invalidateQueries({ queryKey: cardKeys.all() });
17
17
+
queryClient.invalidateQueries({ queryKey: noteKeys.all() });
16
18
queryClient.invalidateQueries({ queryKey: collectionKeys.all() });
17
19
},
18
20
});
+6
-1
src/webapp/features/notes/lib/mutations/useUpdateNote.tsx
···
3
3
import { cardKeys } from '@/features/cards/lib/cardKeys';
4
4
import { collectionKeys } from '@/features/collections/lib/collectionKeys';
5
5
import { feedKeys } from '@/features/feeds/lib/feedKeys';
6
6
+
import { noteKeys } from '../noteKeys';
6
7
7
8
export default function useUpdateNote() {
8
9
const queryClient = useQueryClient();
···
15
16
onSuccess: (data) => {
16
17
queryClient.invalidateQueries({ queryKey: cardKeys.card(data.cardId) });
17
18
queryClient.invalidateQueries({ queryKey: cardKeys.infinite() });
18
18
-
queryClient.invalidateQueries({ queryKey: cardKeys.infinite() });
19
19
+
queryClient.invalidateQueries({
20
20
+
queryKey: cardKeys.infinite(data.cardId),
21
21
+
});
22
22
+
queryClient.invalidateQueries({ queryKey: cardKeys.all() });
23
23
+
queryClient.invalidateQueries({ queryKey: noteKeys.all() });
19
24
queryClient.invalidateQueries({ queryKey: feedKeys.all() });
20
25
queryClient.invalidateQueries({ queryKey: collectionKeys.all() });
21
26
},