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

Title Unnecessary updates to defaultValue and checked properties in <textarea> and <input> elements #32181

Open
Aatirhassanpir opened this issue Jan 23, 2025 · 0 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@Aatirhassanpir
Copy link

Description

It looks like React is updating the defaultValue of <textarea> elements and the checked property of elements even when their values haven’t changed. This leads to unnecessary DOM mutations, which can impact performance, especially when there are many components that re-render frequently.

Steps to Reproduce

Render a controlled <textarea> or with defaultValue or checked set.
Trigger a re-render by updating some other unrelated props.
Notice that React still updates the defaultValue or checked properties, even though the values haven't changed.

Expected Behavior

React should only update the defaultValue or checked properties when the values actually change, avoiding unnecessary DOM updates.

Actual Behavior

The properties are being updated unnecessarily, even if the values remain unchanged, leading to redundant DOM mutations.

Suggested Solution

React should add a check to only update the defaultValue and checked properties if their values have changed. This would reduce unnecessary updates and improve overall performance.

Environment

React version: [Insert React version]
Browser: [Insert browser and version]
Operating System: [Insert OS name and version]

Key Words / Search Terms

defaultValue, checked, textarea, input, performance, DOM mutations, unnecessary updates

Repository Version

v19.0.0

@Aatirhassanpir Aatirhassanpir added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

1 participant