This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

feat: update profile tab counts after adding/removing cards/collections

+8
+2
src/webapp/features/cards/lib/mutations/useAddCard.tsx
··· 6 6 import { noteKeys } from '@/features/notes/lib/noteKeys'; 7 7 import { sembleKeys } from '@/features/semble/lib/sembleKeys'; 8 8 import { connectionKeys } from '@/features/connections/lib/connectionKeys'; 9 + import { profileKeys } from '@/features/profile/lib/profileKeys'; 9 10 import posthog from 'posthog-js'; 10 11 import { 11 12 CardSaveAnalyticsContext, ··· 62 63 queryClient.invalidateQueries({ queryKey: collectionKeys.infinite() }); 63 64 queryClient.invalidateQueries({ queryKey: collectionKeys.all() }); 64 65 queryClient.invalidateQueries({ queryKey: connectionKeys.all() }); 66 + queryClient.invalidateQueries({ queryKey: profileKeys.all() }); 65 67 queryClient.invalidateQueries({ 66 68 queryKey: collectionKeys.bySembleUrl(variables.url), 67 69 });
+2
src/webapp/features/cards/lib/mutations/useRemoveCardFromLibrary.tsx
··· 6 6 import { feedKeys } from '@/features/feeds/lib/feedKeys'; 7 7 import { sembleKeys } from '@/features/semble/lib/sembleKeys'; 8 8 import { connectionKeys } from '@/features/connections/lib/connectionKeys'; 9 + import { profileKeys } from '@/features/profile/lib/profileKeys'; 9 10 10 11 export default function useRemoveCardFromLibrary() { 11 12 const queryClient = useQueryClient(); ··· 22 23 queryClient.invalidateQueries({ queryKey: collectionKeys.all() }); 23 24 queryClient.invalidateQueries({ queryKey: sembleKeys.all() }); 24 25 queryClient.invalidateQueries({ queryKey: connectionKeys.all() }); 26 + queryClient.invalidateQueries({ queryKey: profileKeys.all() }); 25 27 // Invalidate all URL metadata queries with stats to update tab counts 26 28 queryClient.invalidateQueries({ 27 29 predicate: (query): boolean => {
+2
src/webapp/features/collections/lib/mutations/useCreateCollection.tsx
··· 2 2 import { useMutation, useQueryClient } from '@tanstack/react-query'; 3 3 import { createCollection } from '../dal'; 4 4 import { collectionKeys } from '../collectionKeys'; 5 + import { profileKeys } from '@/features/profile/lib/profileKeys'; 5 6 6 7 export default function useCreateCollection() { 7 8 const queryClient = useQueryClient(); ··· 20 21 // https://tkdodo.eu/blog/mastering-mutations-in-react-query#some-callbacks-might-not-fire 21 22 onSuccess: () => { 22 23 queryClient.invalidateQueries({ queryKey: collectionKeys.all() }); 24 + queryClient.invalidateQueries({ queryKey: profileKeys.all() }); 23 25 queryClient.refetchQueries({ queryKey: collectionKeys.mine() }); 24 26 }, 25 27 });
+2
src/webapp/features/collections/lib/mutations/useDeleteCollection.tsx
··· 1 1 import { useMutation, useQueryClient } from '@tanstack/react-query'; 2 2 import { deleteCollection } from '../dal'; 3 3 import { collectionKeys } from '../collectionKeys'; 4 + import { profileKeys } from '@/features/profile/lib/profileKeys'; 4 5 5 6 export default function useDeleteCollection() { 6 7 const queryClient = useQueryClient(); ··· 12 13 13 14 onSuccess: () => { 14 15 queryClient.invalidateQueries({ queryKey: collectionKeys.all() }); 16 + queryClient.invalidateQueries({ queryKey: profileKeys.all() }); 15 17 }, 16 18 }); 17 19