Skip to content

Commit 7e42776

Browse files
committed
fix: more intersection defaults
1 parent a15e991 commit 7e42776

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/components/Chart.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function defaultChartOptions<TDatum>(
7070
interactionMode: options.interactionMode ?? 'primary',
7171
showVoronoi: options.showVoronoi ?? false,
7272
defaultColors: options.defaultColors ?? defaultColorScheme,
73-
useIntersectionObserver: options.useIntersectionObserver ?? true,
73+
useIntersectionObserver: options.useIntersectionObserver ?? false,
7474
intersectionObserverRootMargin:
7575
options.intersectionObserverRootMargin ?? '1000px',
7676
primaryCursor: options.primaryCursor ?? true,
@@ -162,7 +162,7 @@ export function Chart<TDatum>({
162162
}
163163
}, [containerEl])
164164

165-
const [isIntersecting, setIsIntersecting] = React.useState(false)
165+
const [isIntersecting, setIsIntersecting] = React.useState(true)
166166

167167
React.useEffect(() => {
168168
if (!containerEl || !options.useIntersectionObserver) return
@@ -208,9 +208,9 @@ export function Chart<TDatum>({
208208
height,
209209
}}
210210
>
211-
{isIntersecting ? (
211+
{options.useIntersectionObserver && !isIntersecting ? null : (
212212
<ChartInner options={options} {...{ width, height }} />
213-
) : null}
213+
)}
214214
</div>
215215
)
216216
}

0 commit comments

Comments
 (0)