···2626 // Do things that are absolutely necessary and logic related (like query invalidation) in the useMutation callbacks
2727 // Do UI related things like redirects or showing toast notifications in mutate callbacks. If the user navigated away from the current screen before the mutation finished, those will purposefully not fire
2828 // https://tkdodo.eu/blog/mastering-mutations-in-react-query#some-callbacks-might-not-fire
2929- onSuccess: () => {
2929+ onSuccess: (_data, variables) => {
3030 queryClient.invalidateQueries({ queryKey: ['my cards'] });
3131+ queryClient.invalidateQueries({ queryKey: ['library'] });
3232+ queryClient.invalidateQueries({ queryKey: ['collections'] });
3333+3434+ // invalidate each collection query individually
3535+ variables.collectionIds?.forEach((id) => {
3636+ queryClient.invalidateQueries({ queryKey: ['collection', id] });
3737+ });
3138 },
3239 });
3340