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

fix(collapse): stop to regenerate id at each rerender #1102

Conversation

GuillaumeKESTEMAN
Copy link
Contributor

@GuillaumeKESTEMAN GuillaumeKESTEMAN commented Jan 3, 2024

Related issue

#1058

Description of the issue

The browser lost focus of the input because the children's ID was regenerated at each rerender. (if you had not defined a custom id)

I had to rename useId to getId because each function with use is considered has React Hook and we can't put a React Hook in a useMemo.

Person(s) for reviewing proposed changes

@samuel-gomez @MartinWeb

Important

Before creating a pull request run unit tests

$ npm test

# watch for changes
$ npm test -- --watch

# For a specific file (e.g., in packages/context/__tests__/command.test.js)
$ npm test -- --watch packages/action

@GuillaumeKESTEMAN GuillaumeKESTEMAN self-assigned this Jan 3, 2024
@GuillaumeKESTEMAN GuillaumeKESTEMAN added the Type: Bug Something isn't working label Jan 3, 2024
@GuillaumeKESTEMAN GuillaumeKESTEMAN changed the title fix(collapse): stop to generate id at each rerender fix(collapse): stop to regenerate id at each rerender Jan 3, 2024
@GuillaumeKESTEMAN GuillaumeKESTEMAN removed their assignment Jan 3, 2024
@samuel-gomez-axa
Copy link
Contributor

je suggère de plutôt utiliser le useId fournit par React, qu'en pensez-vous ? @GuillaumeKESTEMAN @MartinWeb

@GuillaumeKESTEMAN GuillaumeKESTEMAN marked this pull request as draft January 3, 2024 15:40
@GuillaumeKESTEMAN
Copy link
Contributor Author

je suggère de plutôt utiliser le useId fournit par React, qu'en pensez-vous ? @GuillaumeKESTEMAN @MartinWeb

Je viens de tester et ce n'est pas encore possible dans notre cas car useId est sorti avec React 18, or nous utilisons React 17.

@GuillaumeKESTEMAN GuillaumeKESTEMAN marked this pull request as ready for review January 8, 2024 07:57
Copy link
Contributor

@samuel-gomez samuel-gomez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on changera le useId par celui de React lors de la montée de version v18

@MartinWeb MartinWeb merged commit e6ef73f into AxaFrance:master Jan 16, 2024
3 checks passed
@MartinWeb MartinWeb added this to the v2.3.0 milestone Jan 24, 2024
@GuillaumeKESTEMAN GuillaumeKESTEMAN deleted the fix/form-elements-lose-focus-in-collapse-card branch January 31, 2024 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants