Skip to content

Commit

Permalink
Taking externalRef from dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgperry committed May 12, 2021
1 parent 1d1eb5f commit 2f6c163
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Framer Motion adheres to [Semantic Versioning](http://semver.org/).

## [4.1.16] 2021-05-12

### Fixed

- Use with changing external refs.

## [4.1.15] 2021-05-11

### Fixed
Expand Down
7 changes: 6 additions & 1 deletion src/motion/utils/use-motion-ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export function useMotionRef<Instance, RenderState>(
}
}
},
[visualElement, externalRef]
/**
* Only pass a new ref callback to React if we've received a visual element
* factory. Otherwise we'll be mounting/remounting every time externalRef
* or other dependencies change.
*/
[visualElement]
)
}

0 comments on commit 2f6c163

Please sign in to comment.