onSuccess callback. Here are a few possibilities based on the information provided in the extracts:useForm hook and expecting data to be returned after a mutation (create, update, delete), you should use the onMutationSuccess callback, not onSuccess. The onSuccess callback is used for fetching data, not mutations. You can refer to the useForm documentation (https://refine.dev/docs/api-reference/antd/hooks/form/useForm/#onmutationsuccess) for more details.onMutationSuccess callback from useForm doesn't return data when using the Supabase data provider.undefined as a result. Here are a few possibilities based on the information provided in the extracts:JSON.parse(undefined), it will produce an error because undefined is not JSON. This was explained in a blog post on the refine.dev website (https://refine.dev/blog/unexpected-token-in-json-at-position-0-error#what-does-the-unexpected-token--in-json-at-position-0-error-mean).undefined, you'll get an error. This was reported in a GitHub issue (https://github.com/refinedev/refine/issues/3837) where the user was trying to get user identity data.tokens of an undefined object (like undefined.tokens), you'll get a TypeError: Cannot read properties of undefined (reading 'tokens') error. This was discussed in a Discord support thread (ask-any-questionCannot read properties of undefined (reading 'tokens')).data.data being undefined could be due to several reasons. Here are a few possibilities:data.data implies that the response is an object with a data property, which itself is an object containing the actual data. If your server is not structured this way, data.data would be undefined. You should check the structure of the response from your server.data.data being undefined. You should check your server logs to see if there are any errors.data.data would be undefined. You should check your network requests to see if they are successful.onSuccess callback, you're checking if data.data exists before proceeding with other operations. This is a good practice as it prevents errors if data.data is undefined. However, you might want to add some error handling or logging to understand why data.data is undefined.data object when data.data is undefined, which might help you understand why it's undefined.undefined in the response, it could be due to the way your server or data provider is set up. Some servers or data providers might not return the created record after a create operation.createMutate function, you're expecting the created record to be in data.data in the onSuccess callback. If your server or data provider doesn't return the created record, data.data would be undefined.create operation. If they don't, you might need to make an additional read request to get the created record.onSuccessonSuccessonSuccessonSuccessonSuccessuseFormuseFormonMutationSuccessonMutationSuccessJSON.parse(undefined)tokensundefined.tokensTypeError: Cannot read properties of undefined (reading 'tokens')data.datadata.datadata.datadata.datadata.datadata.datadata.datadata.datadata.datadata.datadata.datacreatecreatecreateMutatereadonSuccess: async (data, variables, context) => {
console.log(data, variables, context, 'dataaa')
if (data.data) {
await createReview(data.data.id, rateValue, review)
await createProductsPlans(data.data.id, selectedPlansIds)
list('temp_products')
} else {
console.log('data.data is undefined', data);
}
},onSuccess: async (data, variables, context) => {{
console.log(data, variables, context, 'dataaa')
if (data.data) {{
await createReview(data.data.id, rateValue, review)
await createProductsPlans(data.data.id, selectedPlansIds)
list('temp_products')
}}
}},