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

BREAKING(Ref): add support for forwardRef API #3405

Merged
merged 4 commits into from
Jan 29, 2019
Merged

Conversation

layershifter
Copy link
Member

@layershifter layershifter commented Jan 29, 2019

Fixes #3255.


This PR implements support of forwardRef API. This allows to implement more correct behavior and provides ability to careful control of refs.

Affects Modal, Popup and Sidebar components. If you're using components without forwardRef() nothing will change for you. Can be breaking in some cases, see details below.

const ExampleButton = React.forwardRef((props, ref) => (
  <div>
    <button {...props} ref={ref} />
  </div>
))
const buttonRef = React.createRef()

render(
  <Ref innerRef={buttonRef}>
    <ExampleButton>Example</ExampleButton>
  </Ref>
)

Before

buttonRef.current // will point to `div`

After

buttonRef.current // will point to `button`

@codecov-io
Copy link

codecov-io commented Jan 29, 2019

Codecov Report

Merging #3405 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3405      +/-   ##
==========================================
+ Coverage   99.89%   99.89%   +<.01%     
==========================================
  Files         170      172       +2     
  Lines        2818     2830      +12     
==========================================
+ Hits         2815     2827      +12     
  Misses          3        3
Impacted Files Coverage Δ
src/addons/Ref/RefFindNode.js 100% <100%> (ø)
src/addons/Ref/RefForward.js 100% <100%> (ø)
src/addons/Ref/Ref.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a263d64...6bb67db. Read the comment docs.

@layershifter layershifter merged commit 7949159 into master Jan 29, 2019
@layershifter layershifter deleted the feat/ref-find branch January 29, 2019 15:33
@layershifter layershifter changed the title feat(Ref): add support for forwardRef API BREAKING(Ref): add support for forwardRef API Jan 29, 2019
@levithomason
Copy link
Member

Released in semantic-ui-react@0.85.0.

bubunyo pushed a commit to bubunyo/Semantic-UI-React that referenced this pull request May 9, 2019
layershifter pushed a commit that referenced this pull request Jun 28, 2019
* feat(Ref): add support for error messages in <Form.Field/> (#3405)

* feat(Ref): add support for error messages in <Form.Field/> (#3602)

* fix(reff) update error proptype to show to to reflect in docs

* use Label component

* remove only

* update descriptions and types

* fix typings issues
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.

3 participants