Skip to content

Commit

Permalink
fix: prevent setup if parent is not visible
Browse files Browse the repository at this point in the history
  • Loading branch information
myklt committed Mar 13, 2023
1 parent 1dee865 commit 96a7790
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ function Split({

// Initial setup, runs every time the child views change.
useEffect(function initialSetup() {
if (!state.isReady) return
if (!state.isReady) return;
if (childRefs.current && !(childRefs.current[0] as any).offsetParent) return;
// By the time first useEffect runs refs should be already set, unless something really bad happened.
if (!childRefs.current || !gutterRefs.current) {
throw new Error(`Cannot create pairs - either variable 'childRefs' or 'gutterRefs' is undefined`);
Expand Down

0 comments on commit 96a7790

Please # to comment.