Skip to content

Commit

Permalink
disconnect observer if always flag isnt on
Browse files Browse the repository at this point in the history
  • Loading branch information
joetannenbaum committed Jan 9, 2025
1 parent f99a14f commit d367a9d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/react/src/WhenVisible.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ const WhenVisible = ({ children, data, params, buffer, as, always, fallback }: W
setLoaded(true)
fetching.current = false
reloadParams.onFinish?.(e)

if (!always) {
observer.disconnect()
}
},
})
},
Expand Down

0 comments on commit d367a9d

Please sign in to comment.