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: Update TextInput ref forwarding #3011

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

ocoutts-usds
Copy link
Contributor

@ocoutts-usds ocoutts-usds commented Aug 23, 2024

Summary

Currently this component forwards refs in a way that does not work in new versions of react and I'm not sure if it ever worked in any version of react. Leaving the old way in case somebody is using it.

@ocoutts-usds ocoutts-usds requested a review from a team as a code owner August 23, 2024 18:58
@ocoutts-usds ocoutts-usds changed the title Bugfix: forwarding refs fix: forwarding refs Aug 26, 2024

TextInput.displayName = 'TextInput'
Copy link
Contributor

Choose a reason for hiding this comment

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

A bit weird, but the existing pattern for making sure the components have a display name is done like so:

I don't remember if there was a reason we did it that way, or if your approach is better, so I won't block on it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am happy to change but I find it a bit strange - this approach makes it so that the display name of the component (shows up in dev tools, error messages) will be DayForwardRef not Day which I find somewhat unideal.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with you. Let's leave it as is. Can always update easily if we find any problems or want to unify one way or the other

@kimallen
Copy link
Contributor

Could you add some context in the Summary for what bug this addresses?

@brandonlenz
Copy link
Contributor

Currently this component forwards refs in a way that does not work in new versions of react and I'm not sure if it ever worked in any version of react. Leaving the old way in case somebody is using it.

Yea this might have been a relic from much older versions of react, since I think this was likely one of the first components built for ReactUSWDS

@brandonlenz brandonlenz changed the title fix: forwarding refs fix!: forwarding refs Aug 26, 2024
@brandonlenz brandonlenz changed the title fix!: forwarding refs fix: forwarding refs Aug 26, 2024
@brandonlenz brandonlenz changed the title fix: forwarding refs fix: Update TextInput ref forwarding Aug 26, 2024
@brandonlenz brandonlenz merged commit f8ac06d into trussworks:main Aug 26, 2024
10 of 11 checks passed
@brandonlenz
Copy link
Contributor

@all-contributors please add ocoutts-usds for bug, code

Copy link
Contributor

@brandonlenz

Could not find the user [ocoutts-usds](https://github.com/ocoutts-usds) on github.

@brandonlenz
Copy link
Contributor

@all-contributors please add @ocoutts-usds for bug,code

Copy link
Contributor

@brandonlenz

I've put up a pull request to add @ocoutts-usds! 🎉

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

Successfully merging this pull request may close these issues.

3 participants