defaultValue={dynamicVariable} is broken after submitting the form.
Here is what is happening: I have a form that contains an Input. This Input has a defaultValue={state?.data?.nextUiInput}. On init, the component has initialState, which includes the initial variables, texts, etc.
On the first render, everything works fine. However, once I submit the form using useActionState (or useFormState) the defaultValue bugs stop displaying the defaultvalue. Even tho exists.
I tested the same procedure on a normal input field and it works as expected, everything is fine even after submitting the form, etc.
Here is my initialState
"use server";
export default async function createOrder(
prevState: any,
formData: FormData
) {
const formDataObj = {
nextUiInput: formData.get("nextUiInput"),
normalInput: formData.get("normalInput"),
};
return {
...prevState,
success: true,
message: "Order created successfully",
data: {
...prevState.data,
...formDataObj,
nextUiInput: "New NextUI Input Value",
normalInput: "New Normal Input Value",
},
};
}
I am using react 19, nextJS 15
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
Just install the newest nextJs 15 version and follow the manual installation guide of NextUI
Add the scripts above, disable TurboPack and start the application
Expected behavior
On submitting the form, the new defaultValue get's updated.
NextUI Version
2.4.8
Describe the bug
defaultValue={dynamicVariable}
is broken after submitting the form. Here is what is happening: I have a form that contains an Input. This Input has adefaultValue={state?.data?.nextUiInput}
. On init, the component hasinitialState
, which includes the initial variables, texts, etc. On the first render, everything works fine. However, once I submit the form usinguseActionState
(oruseFormState
) the defaultValue bugs stop displaying the defaultvalue. Even tho exists. I tested the same procedure on a normal input field and it works as expected, everything is fine even after submitting the form, etc. Here is my initialStateHere is my component
Here is my Backend, the createOrder function
I am using react 19, nextJS 15
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
Just install the newest nextJs 15 version and follow the manual installation guide of NextUI Add the scripts above, disable TurboPack and start the application
Expected behavior
On submitting the form, the new defaultValue get's updated.
Screenshots or Videos
Operating System Version
windows
Browser
Chrome