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(components): fix for RHL #5929

Merged
merged 3 commits into from
Apr 29, 2020

Conversation

asudoh
Copy link
Contributor

@asudoh asudoh commented Apr 24, 2020

This change fixes the issue that comes with unmatched component class ref vs. its RHL-proxied version. The issue was observed with running <ComposedModal> in Carbon website's component live demo pane, opening the modal and hitting the close button.

Applied a similar fix to <DatePicker>.

Fixes #2630.

Changelog

Changed

  • Replaces direct .type check to component class with React.createElement(ComponentClass).type.

Testing / Reviewing

Testing should make sure <ComposedModal> and <DatePicker> are not broken.

This change fixes the issue that comes with unmatched component class
ref vs. its RHL-proxied version. The issue was observed with running
`<ComposedModal>` in Carbon website's component live demo pane, opening
the modal and hitting the close button.

Applied a similar fix to `<DatePicker>`.

Fixes carbon-design-system#2630.
@asudoh asudoh requested review from emyarod and a team April 24, 2020 09:35
@ghost ghost requested review from joshblack and removed request for a team April 24, 2020 09:35
@netlify
Copy link

netlify bot commented Apr 24, 2020

Deploy preview for carbon-elements ready!

Built with commit 9b09a46

https://deploy-preview-5929--carbon-elements.netlify.app

@netlify
Copy link

netlify bot commented Apr 24, 2020

Deploy preview for carbon-components-react ready!

Built with commit 9b09a46

https://deploy-preview-5929--carbon-components-react.netlify.app

Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

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

looks good to me

if (index === 0 && child.type === DatePickerInput) {
if (
index === 0 &&
child.type === React.createElement(DatePickerInput).type
Copy link
Contributor

Choose a reason for hiding this comment

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

Would we have any prop type warnings if we do createElement without required props (I think id in this case)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch - Updated.

@joshblack joshblack requested a review from a team as a code owner April 29, 2020 15:02
@ghost ghost requested review from aledavila and dakahn April 29, 2020 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Different appearances of components when using react-hot-loader
3 participants