Has Next Safe Actions any problem? Because i cannot run
Answered
Selkirk Rex posted this in #help-forum
Selkirk RexOP
const { execute } = useAction(updateCurrentUser, {
onError: (error) => {
console.log(error);
},
onExecute: (d) => {
console.log("executing");
},
onSuccess: (data) => {
console.log("successes");
},
});
I ma using next safe actions.
here on onExecute code is called.
but when there is success in nextjs server action then onSuccess is not called.
onError: (error) => {
console.log(error);
},
onExecute: (d) => {
console.log("executing");
},
onSuccess: (data) => {
console.log("successes");
},
});
I ma using next safe actions.
here on onExecute code is called.
but when there is success in nextjs server action then onSuccess is not called.
Answered by Selkirk Rex
I didnot think a lot so downloaded canary version of NextJS and it worked
21 Replies
Selkirk RexOP
export const updateCurrentUser = action(schema, async ({ data }) => {
return { success: "Successfully updated current user" };
});maybe i will downgrade
and let me see
if there can be another issue
please help me
downgrade didnot help
i dont want to write this safe actions myself maybe there should be some thing that i missed
need more information
@ᴉuɐpɹɐɐ is the onError callback called?
Selkirk RexOP
Nope
onSettled is not called as well
how did you call the action
Selkirk RexOP
with execute
i tried new version but new version uses canary version of Nextjs, and there was some type defintions problem
is canary unstable, or should i go with it?
can you try not destructuring the
{ execute } and instead use something like update.executeSelkirk RexOP
okay i will test it
but firstly i should downgrade to nextjs 14.2.2
and i will say to you
Selkirk RexOP
I didnot think a lot so downloaded canary version of NextJS and it worked
Answer