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

TextField Label doesn't shrink when populated after data fetch from the server #45141

Open
Jonathanperez990 opened this issue Jan 29, 2025 · 1 comment
Assignees
Labels
component: text field This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information

Comments

@Jonathanperez990
Copy link

Jonathanperez990 commented Jan 29, 2025

Steps to reproduce

No response

Current behavior

TextField component's label doesn't shrink automatically when react hook form's reset function is called.
It does update if I change and save my code without refreshing which makes the component rerender with the data already fetched and then the labels do shrink.
I've tried everything from setting defaultValue="" on textFields to dynamically use the shrink property but nothing's working and this shouldn't be so hard

Expected behavior

No response

Context

No response

Your environment

npx @mui/envinfo
  System:
    OS: Windows 11 10.0.22631
  Binaries:
    Node: 16.0.0 - ~\.nvm\versions\node\v16.0.0\bin\node.EXE
    npm: 7.10.0 - ~\.nvm\versions\node\v16.0.0\bin\npm.CMD
    pnpm: Not Found
  Browsers:
    Chrome
  npmPackages:
    @emotion/react: ^11.14.0 => 11.14.0 
    @emotion/styled: ^11.14.0 => 11.14.0 
    @mui/core-downloads-tracker:  6.4.1 
    @mui/material: ^6.4.1 => 6.4.1 
    @mui/private-theming:  6.4.1 
    @mui/styled-engine:  6.4.0 
    @mui/system:  6.4.1 
    @mui/types:  7.2.21 
    @mui/utils:  6.4.1 
    @mui/x-date-pickers: ^7.24.1 => 7.24.1 
    @mui/x-internals:  7.24.1 
    @types/react: ^18.3.18 => 18.3.18 
    react: ^18.0.0 => 18.3.1 
    react-dom: ^18.0.0 => 18.3.1
    typescript: ^4.9.5 => 4.9.5


Search keywords: TextField label doesn't shrink

@Jonathanperez990 Jonathanperez990 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 29, 2025
@DiegoAndai DiegoAndai self-assigned this Jan 29, 2025
@DiegoAndai
Copy link
Member

Hey @Jonathanperez990, thanks for the report! Could you provide a minimal reproduction? This would help a lot. A live example would be perfect. This StackBlitz sandbox template may be a good starting point. Thank you!

@DiegoAndai DiegoAndai added status: waiting for author Issue with insufficient information component: text field This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: text field This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information
Projects
None yet
Development

No branches or pull requests

2 participants