You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the form state is defined as just { errorMap, errors, values }, which makes it impossible to have a server action that also return non-value data. A simple example here would be a dropdown with options that can change after each form submit.
My suggestion would be something simple like a type annotation on formOptions, which if set would infer form state of { data, errorMap, errors, values }, with data then being included for purposes of form.Subscribe and so on. Server actions would return { ...state, data: { ... } } to change the data value, or { ...state, ...error.formState } in case of errors (reusing the existing data).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Currently the form state is defined as just
{ errorMap, errors, values }
, which makes it impossible to have a server action that also return non-value data. A simple example here would be a dropdown with options that can change after each form submit.My suggestion would be something simple like a type annotation on
formOptions
, which if set would infer form state of{ data, errorMap, errors, values }
, withdata
then being included for purposes ofform.Subscribe
and so on. Server actions would return{ ...state, data: { ... } }
to change the data value, or{ ...state, ...error.formState }
in case of errors (reusing the existing data).Beta Was this translation helpful? Give feedback.
All reactions