isSuccess is alway false when not returning data.
koveitan opened this issue · 2 comments
koveitan commented
i am trying your example from the docs:
export const produceNewMessage = createServerAction()
.input(
z.object({
name: z.string().min(5),
}),
{
type: "formData",
}
)
.handler(async ({ input }) => {
await new Promise((resolve) => setTimeout(resolve, 500))
return "Hello, " + input.name
})
it seems that when removing the return statement, the isSuccess is never true it is always false, is this the intended behavior ?
IdoPesok commented
Hi, thanks for catching this. Valid bug with undefined data.
Fixing here, #139 -- running tests now and added unit test for this case. Will update once released.
IdoPesok commented
Please bump to zsa-react@0.1.8
. It will now be able to handle isSuccess
for functions returning void
, null
, or undefined
.