Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

fix(Ref): handle refs on updates of innerRef prop #1331

Merged
merged 1 commit into from
May 13, 2019

Conversation

layershifter
Copy link
Member

Fixes #1328.

Align existing behavior with React's, see the issue for more context and explanation.

@DustyTheBot
Copy link
Collaborator

Warnings
⚠️ There are no updates provided to CHANGELOG. Ensure there are no publicly visible changes introduced by this PR.

Generated by 🚫 dangerJS

@codecov
Copy link

codecov bot commented May 13, 2019

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1331      +/-   ##
==========================================
+ Coverage   72.32%   72.33%   +<.01%     
==========================================
  Files         759      759              
  Lines        5692     5694       +2     
  Branches     1687     1664      -23     
==========================================
+ Hits         4117     4119       +2     
  Misses       1569     1569              
  Partials        6        6
Impacted Files Coverage Δ
packages/react-component-ref/src/RefFindNode.tsx 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 bca7430...9a79b00. Read the comment docs.

@@ -32,13 +32,17 @@ export default class RefFindNode extends React.Component<RefFindNodeProps> {
handleRef(this.props.innerRef, this.prevNode)
}

componentDidUpdate() {
componentDidUpdate(prevProps: RefFindNodeProps) {
Copy link
Contributor

Choose a reason for hiding this comment

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

think that it might be beneficial to implement this component with Hooks, for couple of reasons

  • in that case we will have explicit update dependencies specified in useEffect
  • explicitness on unsubscribe actions for effects
  • this component is fairly small in terms of amount of code

@layershifter layershifter merged commit 13da159 into master May 13, 2019
@delete-merged-branch delete-merged-branch bot deleted the fix/ref-updates branch May 13, 2019 14:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🧰 fix Introduces fix for broken behavior. 🚀 ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ref: refs should be update on their change
3 participants