Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] -Textarea loses content after submit #4040

Open
rhufsky opened this issue Nov 13, 2024 · 3 comments
Open

[BUG] -Textarea loses content after submit #4040

rhufsky opened this issue Nov 13, 2024 · 3 comments

Comments

@rhufsky
Copy link

rhufsky commented Nov 13, 2024

NextUI Version

2.4.8 and 2.5-beta.8 and
"@nextui-org/input": "^2.3.0-beta.6",
"@nextui-org/system": "^2.3.0-beta.4",
"@nextui-org/theme": "^2.3.0-beta.6"

Describe the bug

Textarea seems to temporarily lose its content on form submit with a NextJS server side action that does not refresh the page. I have a Textarea that is used as a controlled component.

Submit is handled by a form action, which is cliend side for sake of brevity.

  • Whenever I enter text, it is displayed.
  • When I hit Submit, the text disappears and the defaultValue is displayed.
  • When I hover over the textarea, the entered text reappears.

I use NextJS15 / React 19 RC. I tried NextUI 2.4.8 and NextUI 2.5 beta.

Your Example Website or App

https://github.com/rhufsky/nextui-demo

Steps to Reproduce the Bug or Issue

  1. open the form
  2. enter value in the textarea
  3. hit submit
  4. hover over the textarea

Expected behavior

The textarea should keep its value even after a submit, given the value comes from the state and all other components display the state as well.

The goal is to do verification in a server action. In case of a verification error, the form fields contents should be as entered by the user.

Screenshots or Videos

No response

Operating System Version

MacOS, bun

Browser

Chrome

Copy link

linear bot commented Nov 13, 2024

@prudvinani
Copy link

@wingkwong , I would like to work on this issue. Could you please provide a video explaining the exact bug and the location of the component so that I can understand it better?

@rhufsky
Copy link
Author

rhufsky commented Nov 15, 2024

The source code is here: https://github.com/rhufsky/nextui-demo.

The relevant code is in src/components/TextAreaDemoForm.tsx

Start the app:

image

Enter data

image

Hit "Submit", input data in NextUI Textarea disappears and is replaced by default value.

image

Hover over Textarea NextUI, input data reappears

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants