This repository was archived by the owner on Nov 9, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ export function Tippy({
5050 enabled = false ;
5151 }
5252
53+ const deps = [ children . type ] ;
54+
5355 // CREATE
5456 useIsomorphicLayoutEffect ( ( ) => {
5557 const instance = tippy ( component . ref , props , plugins ) ;
@@ -73,7 +75,7 @@ export function Tippy({
7375 return ( ) => {
7476 instance . destroy ( ) ;
7577 } ;
76- } , [ children . type ] ) ;
78+ } , deps ) ;
7779
7880 // UPDATE
7981 useIsomorphicLayoutEffect ( ( ) => {
@@ -102,7 +104,7 @@ export function Tippy({
102104 }
103105 } ) ;
104106
105- useUpdateClassName ( component , className , children . type ) ;
107+ useUpdateClassName ( component , className , deps ) ;
106108
107109 return (
108110 < >
Original file line number Diff line number Diff line change @@ -5,7 +5,11 @@ import {render, cleanup} from '@testing-library/react';
55afterEach ( cleanup ) ;
66
77describe ( '<Tippy />' , ( ) => {
8- let instance ;
8+ let instance = null ;
9+
10+ afterEach ( ( ) => {
11+ instance = null ;
12+ } ) ;
913
1014 function Tippy ( props ) {
1115 return < TippyBase { ...props } onCreate = { i => ( instance = i ) } /> ;
@@ -36,7 +40,7 @@ describe('<Tippy />', () => {
3640 </ Tippy > ,
3741 ) ;
3842
39- expect ( instance ) . toBeDefined ( ) ;
43+ expect ( instance ) . not . toBeNull ( ) ;
4044 } ) ;
4145
4246 test ( 'renders react element content inside the content prop' , ( ) => {
@@ -236,7 +240,7 @@ describe('<Tippy />', () => {
236240 </ Tippy > ,
237241 ) ;
238242
239- expect ( instance ) . toBeDefined ( ) ;
243+ expect ( instance ) . not . toBeNull ( ) ;
240244 } ) ;
241245
242246 test ( 'refs are preserved on the child' , done => {
You can’t perform that action at this time.
0 commit comments