A social knowledge tool for researchers built on ATProto

fix: semble, note, collection query keys

+23 -7
+4
src/webapp/features/cards/lib/mutations/useUpdateCardAssociations.tsx
··· 2 2 import { useMutation, useQueryClient } from '@tanstack/react-query'; 3 3 import { cardKeys } from '../cardKeys'; 4 4 import { collectionKeys } from '@/features/collections/lib/collectionKeys'; 5 + import { noteKeys } from '@/features/notes/lib/noteKeys'; 6 + import { sembleKeys } from '@/features/semble/lib/sembleKeys'; 5 7 6 8 export default function useUpdateCardAssociations() { 7 9 const client = createSembleClient(); ··· 25 27 26 28 onSuccess: (_data, variables) => { 27 29 queryClient.invalidateQueries({ queryKey: cardKeys.all() }); 30 + queryClient.invalidateQueries({ queryKey: noteKeys.all() }); 31 + queryClient.invalidateQueries({ queryKey: sembleKeys.all() }); 28 32 queryClient.invalidateQueries({ queryKey: collectionKeys.mine() }); 29 33 queryClient.invalidateQueries({ queryKey: collectionKeys.infinite() }); 30 34
+1 -1
src/webapp/features/collections/lib/queries/useCollection.tsx
··· 12 12 const limit = props.limit ?? 20; 13 13 14 14 return useSuspenseInfiniteQuery({ 15 - queryKey: collectionKeys.collection(props.rkey), 15 + queryKey: collectionKeys.infinite(), 16 16 initialPageParam: 1, 17 17 queryFn: ({ pageParam }) => 18 18 getCollectionPageByAtUri({
+5 -3
src/webapp/features/notes/lib/mutations/useUpdateNote.tsx
··· 1 1 import { useMutation, useQueryClient } from '@tanstack/react-query'; 2 2 import { updateNoteCard } from '../dal'; 3 + import { cardKeys } from '@/features/cards/lib/cardKeys'; 4 + import { collectionKeys } from '@/features/collections/lib/collectionKeys'; 3 5 4 6 export default function useUpdateNote() { 5 7 const queryClient = useQueryClient(); ··· 10 12 }, 11 13 12 14 onSuccess: (data) => { 13 - queryClient.invalidateQueries({ queryKey: ['card', data.cardId] }); 14 - queryClient.invalidateQueries({ queryKey: ['collection'] }); 15 - queryClient.invalidateQueries({ queryKey: ['collections'] }); 15 + queryClient.invalidateQueries({ queryKey: cardKeys.card(data.cardId) }); 16 + queryClient.invalidateQueries({ queryKey: cardKeys.infinite() }); 17 + queryClient.invalidateQueries({ queryKey: collectionKeys.all() }); 16 18 }, 17 19 }); 18 20
+6
src/webapp/features/notes/lib/noteKeys.ts
··· 1 + export const noteKeys = { 2 + all: () => ['notes'] as const, 3 + note: (id: string) => [...noteKeys.all(), id] as const, 4 + bySembleUrl: (url: string) => [...noteKeys.all(), url], 5 + infinite: () => [...noteKeys.all(), 'infinite'], 6 + };
+3 -2
src/webapp/features/notes/lib/queries/useSembleNotes.tsx src/webapp/features/semble/lib/queries/useSembleNotes.ts
··· 1 + import { getNoteCardsForUrl } from '@/features/notes/lib/dal'; 1 2 import { useSuspenseInfiniteQuery } from '@tanstack/react-query'; 2 - import { getNoteCardsForUrl } from '../dal'; 3 + import { sembleKeys } from '../sembleKeys'; 3 4 4 5 interface Props { 5 6 url: string; ··· 10 11 const limit = props?.limit ?? 16; 11 12 12 13 const notes = useSuspenseInfiniteQuery({ 13 - queryKey: ['semble notes', props.url, limit], 14 + queryKey: sembleKeys.notesInfinite(props.url), 14 15 initialPageParam: 1, 15 16 queryFn: ({ pageParam = 1 }) => { 16 17 return getNoteCardsForUrl(props.url, { page: pageParam, limit });
+1 -1
src/webapp/features/semble/containers/sembleNotesContainer/SembleNotesContainer.tsx
··· 1 1 'use client'; 2 2 3 - import useSembleNotes from '@/features/notes/lib/queries/useSembleNotes'; 3 + import useSembleNotes from '@/features/semble/lib/queries/useSembleNotes'; 4 4 import InfiniteScroll from '@/components/contentDisplay/infiniteScroll/InfiniteScroll'; 5 5 import { Grid } from '@mantine/core'; 6 6 import SembleNotesContainerError from './Error.SembleNotesContainer';
+3
src/webapp/features/semble/lib/sembleKeys.ts
··· 1 1 export const sembleKeys = { 2 2 all: () => ['semble'] as const, 3 3 byUrl: (url: string) => [...sembleKeys.all(), url] as const, 4 + notes: (url: string) => [...sembleKeys.byUrl(url), 'notes'] as const, 5 + notesInfinite: (url: string) => 6 + [...sembleKeys.notes(url), 'infinite'] as const, 4 7 similarCards: (url: string) => 5 8 [...sembleKeys.byUrl(url), 'similar cards'] as const, 6 9 similarCardsInfinite: (url: string) =>