Symptoms:
- You see errors like “WebGPU not supported in this browser”.
- The chart never becomes ready.
Fix:
- Use a browser with WebGPU enabled (Chrome/Edge 113+, Safari 18+).
- Check enterprise policies / flags that may disable WebGPU.
- Try a fresh browser profile (extensions can interfere with GPU features).
Notes:
useChartGPUperforms a WebGPU support check ('gpu' in navigator) and surfaces anerror.- The
ChartGPUcomponent does not do a pre-check; ifchartgputhrows during create, it logs a console error.
Symptoms:
- No visible chart, but no obvious error.
Fix:
- Ensure the container has an explicit, non-zero height:
style={{ height: 400 }}or CSSheight: 400px- If you use flex layouts, make sure parent containers allow the child to grow.
Both the component and hook attach a ResizeObserver and call chart.resize() (debounced), but they cannot recover from a permanently 0px container.
Symptoms:
ReferenceError: navigator is not defined- Hydration mismatch when rendering charts on the server
Fix:
- Render charts client-side only:
- Next.js: dynamic import with
ssr: false, or render behind auseEffectflag. - Ensure any code path that touches WebGPU only runs in the browser.
- Next.js: dynamic import with
Symptoms:
- You see create/dispose happen twice during development.
Cause:
- React StrictMode runs effects twice in development to find unsafe side effects.
Notes:
ChartGPUanduseChartGPUare written to be safe under this behavior (async create race + cleanup ordering).- Avoid caching chart instances outside React state/refs; prefer
onReadyandrefaccess.
Symptoms:
- Warnings like “ResizeObserver loop limit exceeded”.
Mitigations:
- Avoid layout thrash (e.g. updating container size synchronously in response to resize).
- Prefer stable container sizing and let the chart resize inside it.
- The wrapper debounces resize calls (100ms) to reduce churn.