diff --git a/packages/components/src/components/SquiggleChart.tsx b/packages/components/src/components/SquiggleChart.tsx index 91e1a7b8..c48696bb 100644 --- a/packages/components/src/components/SquiggleChart.tsx +++ b/packages/components/src/components/SquiggleChart.tsx @@ -56,7 +56,7 @@ export interface SquiggleChartProps { enableLocalSettings?: boolean; /** The project that this execution is part of */ project?: SqProject; - /** The name of the squiggle execution source. Defaults to "main" */ + /** The name of the squiggle execution source. Generates a UUID if not given */ sourceName?: string; /** The sources that this execution continues */ includes?: string[]; diff --git a/packages/components/src/lib/hooks/useSquiggle.ts b/packages/components/src/lib/hooks/useSquiggle.ts index 085bc6f9..9878206e 100644 --- a/packages/components/src/lib/hooks/useSquiggle.ts +++ b/packages/components/src/lib/hooks/useSquiggle.ts @@ -69,11 +69,13 @@ export const useSquiggle = (args: SquiggleArgs) => { useEffect(() => { return () => { - if (!args.sourceName) args.project.clean(result.sourceName); + if (result.needsClean) args.project.clean(result.sourceName); if (args.project.getSource(importSourceName(result.sourceName))) args.project.clean(result.sourceName); }; - }); + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + []); return result; };