Skip to content

Commit

Permalink
fix: more intersection defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
tannerlinsley committed Aug 5, 2022
1 parent a15e991 commit 7e42776
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function defaultChartOptions<TDatum>(
interactionMode: options.interactionMode ?? 'primary',
showVoronoi: options.showVoronoi ?? false,
defaultColors: options.defaultColors ?? defaultColorScheme,
useIntersectionObserver: options.useIntersectionObserver ?? true,
useIntersectionObserver: options.useIntersectionObserver ?? false,
intersectionObserverRootMargin:
options.intersectionObserverRootMargin ?? '1000px',
primaryCursor: options.primaryCursor ?? true,
Expand Down Expand Up @@ -162,7 +162,7 @@ export function Chart<TDatum>({
}
}, [containerEl])

const [isIntersecting, setIsIntersecting] = React.useState(false)
const [isIntersecting, setIsIntersecting] = React.useState(true)

React.useEffect(() => {
if (!containerEl || !options.useIntersectionObserver) return
Expand Down Expand Up @@ -208,9 +208,9 @@ export function Chart<TDatum>({
height,
}}
>
{isIntersecting ? (
{options.useIntersectionObserver && !isIntersecting ? null : (
<ChartInner options={options} {...{ width, height }} />
) : null}
)}
</div>
)
}
Expand Down

0 comments on commit 7e42776

Please sign in to comment.