Skip to content

Commit

Permalink
Merge pull request #25 from myklt/master
Browse files Browse the repository at this point in the history
fix: prevent setup if parent is not visible
  • Loading branch information
mlejva authored Aug 5, 2023
2 parents e47a5d7 + 96a7790 commit 95f3063
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 95f3063

Please # to comment.