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(attributes-to-props): don't convert value of option tag #790

Merged
merged 6 commits into from
Jan 5, 2023

Conversation

adammockor
Copy link
Contributor

@adammockor adammockor commented Jan 5, 2023

What is the motivation for this pull request?

Fixes #625 and closes ##628. Not sure if there is another element affected with this issue then option.

What is the current behavior?

attributesToProps converts value attribute to defaultValue of option element what is not desirable.

What is the new behavior?

value attribute is preserved on option element.

Checklist:

Sorry, something went wrong.

Unverified

This user has not yet uploaded their public signing key.
Copy link
Owner

@remarkablemark remarkablemark 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 overall, left some comments

@remarkablemark remarkablemark added the bug Something isn't working label Jan 5, 2023
@remarkablemark
Copy link
Owner

@adammockor You'll also need to update .size-limit.json since it has increased:

npm run size-limit

@adammockor
Copy link
Contributor Author

adammockor commented Jan 5, 2023

Thank you for review.

About the API, I am not sure how to approach it. I made second parameter nodeName optional - so it's no breaking change, but this way it's not obvious why nodeName should be passed. Could be better to pass just node into the function (and rename it to nodeAttributesToProps). You could consider it for next major release.

Copy link
Owner

@remarkablemark remarkablemark left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my previous comments. I've left 2 more comments.

@remarkablemark
Copy link
Owner

Thank you for review.

About the API, I am not sure how to approach it. I made second parameter nodeName optional - so it's no breaking change, but this way it's not obvious why nodeName should be passed. Could be better to pass just node into the function (and rename it to nodeAttributesToProps). You could consider it for next major release.

I think the 2nd parameter is fine since it's optional and backwards compatible. Thanks for opening this PR!

Copy link
Owner

@remarkablemark remarkablemark left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov-commenter
Copy link

Codecov Report

Merging #790 (757e0f7) into master (0062056) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #790   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines          171       172    +1     
  Branches        57        58    +1     
=========================================
+ Hits           171       172    +1     
Impacted Files Coverage Δ
lib/attributes-to-props.js 100.00% <100.00%> (ø)
lib/dom-to-react.js 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@remarkablemark remarkablemark merged commit bb4bf49 into remarkablemark:master Jan 5, 2023
@remarkablemark
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

value= shouldn't be converted to defaultValue= for <option>
3 participants