IdoPesok / zsa

https://zsa.vercel.app
MIT License
491 stars 15 forks source link

Support multiple input arguments #158

Closed Exzotic5485 closed 1 week ago

Exzotic5485 commented 1 week ago

It would be nice to be able to pass multiple arguments to the server action, this would make it easier to pass additional arguments with the bind method as this can be done with server actions normally.

For reference: https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations#passing-additional-arguments

IdoPesok commented 1 week ago

Hi, if you are using useServerAction with an action with type as formData, you can pass in additional data in the second argument of the execute method.

In this example, name comes from the form and I pass in the other args through code.

Screen Shot 2024-07-04 at 12 26 04 PM Screen Shot 2024-07-04 at 12 27 27 PM

Still thinking about a bind solution, but lmk if this solves your problem.

IdoPesok commented 1 week ago

Hi, just made a release to hopefully make this easier. Please try upgrading to zsa-react@0.2.2 and checkout these docs

Going to close this issue for now -- lmk if this still doesn't solve your problem.