export const useAddDeckMutation = () => {
const queryClient = useQueryClient()
return useMutation({
mutationFn: postDeck,
onSuccess: (data) => {
if(data){
// Detail item
queryClient.setQueryData(DECK_QUERY_KEYS.detail(data.id.toString()), data)
// Manipulate card list
const list = queryClient.getQueryData(DECK_QUERY_KEYS.list()) as InfiniteData<PaginateListType<DeckType>>
if(list.pages && list.pages.length > 0) list.pages[0].data = [
data,
...list.pages[0].data,
]
queryClient.setQueryData(DECK_QUERY_KEYS.list(), list)
}
return data
}
})
}
https://x.com/tan_stack/status/2031128535470104577?s=20
dry-scarlet · 6h ago
https://x.com/powersync_/status/2010721010006552775?s=20
dry-scarlet · 2mo ago
You can now submit your website/app/project to http://TanStack.com 's new showcase and have it seen by the TanStack community! - Global showcase browser - Per-library filters - Category filters Submit here: https://tanstack.com/showcase/submit View all here: https://tanstack.com/showcase
dry-scarlet · 3mo ago