-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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(react): updated textarea counter value changes on re-render #13449
fix(react): updated textarea counter value changes on re-render #13449
Conversation
✅ Deploy Preview for carbon-components-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this story into the TextArea
story file:
export const Test = () => {
return (<>
<TextInput
labelText="TextInputLabel"
placeholder="Type something here"
onChange={(e) =>
(document.getElementById("text-area").value = e.target.value)
}
/>
<br></br>
<br></br>
<TextArea
id="text-area"
labelText="TextAreaLabel"
maxCount={500}
enableCounter
placeholder="Counter should be updated when value is changed by typing something in the TextInput"
/>
</>)
}
and loaded my local storybook and did not see the value update upon typing:
packages/react/src/components/TextArea/__tests__/TextArea-test.js
Outdated
Show resolved
Hide resolved
packages/react/src/components/TextArea/__tests__/TextArea-test.js
Outdated
Show resolved
Hide resolved
packages/react/src/components/TextArea/__tests__/TextArea-test.js
Outdated
Show resolved
Hide resolved
packages/react/src/components/TextArea/__tests__/TextArea-test.js
Outdated
Show resolved
Hide resolved
@TannerS let us know if can address the feedback / review comments :) thanks again for the contribution! |
Oh yes sorry, I been out but I'll look this week!
Sent from my T-Mobile 5G Device
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Andrea N. Cardona ***@***.***>
Sent: Thursday, April 13, 2023 11:23:55 AM
To: carbon-design-system/carbon ***@***.***>
Cc: Tanner Summers ***@***.***>; Mention ***@***.***>
Subject: Re: [carbon-design-system/carbon] fix(react): updated textarea counter value changes on re-render (PR #13449)
@TannerS<https://github.com/TannerS> let us know if can address the feedback / review comments :) thanks again for the contribution!
—
Reply to this email directly, view it on GitHub<#13449 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACDUUDZ33LM4647WZEGVOR3XBBADXANCNFSM6AAAAAAWPLSYXM>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Co-authored-by: Francine Lucca <40550942+francinelucca@users.noreply.github.com>
hello, i can shoe u over a call if you want, i lost some of my code but i can re-create it, i did it going off this #12348 (comment) since i dont think updating the dom directly is possible to trigger anything |
You're right @TannerS , thanks for clearing that up. I tried it with
I did find one bug in which the counter gets updated when attempting to type into the textArea directly in this scenario , the counter changes but the text does not (expected but the text but not for the counter). See attached screen record Screen.Recording.2023-04-17.at.2.15.50.PM.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #13449 (comment)
sorry guys this is a bit old i been gone but now i can continue, is there anything else needed on my end? @francinelucca @andreancardona |
@TannerS were you able to address Francine's comment? If so, I can take a look and test locally :) |
I think I did...if not I can go over stuff in an office hours
Sent from my T-Mobile 5G Device
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Andrea N. Cardona ***@***.***>
Sent: Monday, May 8, 2023 12:29:12 PM
To: carbon-design-system/carbon ***@***.***>
Cc: Tanner Summers ***@***.***>; Mention ***@***.***>
Subject: Re: [carbon-design-system/carbon] fix(react): updated textarea counter value changes on re-render (PR #13449)
@TannerS<https://github.com/TannerS> were you able to address Francine's comment? If so, I can take a look and test locally :)
—
Reply to this email directly, view it on GitHub<#13449 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACDUUD3PZU6SFHAKXHPNTIDXFEUORANCNFSM6AAAAAAWPLSYXM>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I'm still seeing the error referenced here when running locally, happy to discuss further! |
Met with @TannerS and opted to add a Doing this because the This should be ready for review @andreancardona |
- use value,defaultValue in useEffect insead of ref - delay textCount assignation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewed and looks good!
This PR could not be merged because the GitHub API returned an internal server error. To enable Kodiak on this pull request please remove the When the GitHub API returns an internal server error (HTTP status code 500), it is not safe for Kodiak to retry merging. For more information please see https://kodiakhq.com/docs/troubleshooting#merge-errors If you need help, you can open a GitHub issue, check the docs, or reach us privately at support@kodiakhq.com. |
…on-design-system#13449) * fix(react): updated textarea counter value changes on re-render * fix: format * Update packages/react/src/components/TextArea/__tests__/TextArea-test.js * Update packages/react/src/components/TextArea/__tests__/TextArea-test.js * Update packages/react/src/components/TextArea/__tests__/TextArea-test.js * Update packages/react/src/components/TextArea/__tests__/TextArea-test.js Co-authored-by: Francine Lucca <40550942+francinelucca@users.noreply.github.com> * fix(TextArea): use textarea ref value instead of [value,defaultValue] * fix: format * fix(TextArea): add value to textCounter dependency array * fix(TextArea): textCount optimizations - use value,defaultValue in useEffect insead of ref - delay textCount assignation * fix: format --------- Co-authored-by: Francine Lucca <francinelucca@hotmail.com> Co-authored-by: Andrea N. Cardona <cardona.n.andrea@gmail.com> Co-authored-by: Francine Lucca <40550942+francinelucca@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Closes #
#12348
Changelog
New
Changed
Testing / Reviewing
I actually had to use the sandbox code and manually insert it into the storybook for local testing but its not something that will be testable in storybook
NOTE: will conflict with test file here: https://github.com/carbon-design-system/carbon/pull/12906/files#diff-67daf23818c005abac39307f47f299b05283736cfede71b034c3b2d127f48fcf