T
TanStack15mo ago
stormy-gold

onSuccess not avaivle in useSuspenseQuery

const { data } = useSuspenseQuery({ queryKey: ["messages", id], queryFn: async () => { const res = await fetchConversations(id); return res; }, onSuccess: (data) => { dispatch(setMessages(data)); if (data?.length !== 0) dispatch(fetchSuggestions(id)); }, }); so cuurently i cant access the Object literal may only specify known properties, and 'onSuccess' does not exist in type 'UseSuspenseQueryOptions<Message[] | undefined, Error, Message[] | undefined, string[]>'.ts(2353 onSuccess callback on useSuspense query so if i want to dispatch that data on to redux store after its gets fetched how can i do
1 Reply
extended-salmon
extended-salmon15mo ago
You don’t

Did you find this page helpful?