Fix some collection issues

This commit is contained in:
Sam Nolan 2022-09-22 10:02:15 +10:00
parent 94b4744bea
commit 3ae442ee1f
2 changed files with 5 additions and 3 deletions

View File

@ -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[];

View File

@ -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;
};