Format and ts errors

This commit is contained in:
Sam Nolan 2022-09-26 13:55:22 +10:00
parent 64f9c9ddfc
commit b4fbd1f8e8
2 changed files with 13 additions and 11 deletions

View File

@ -2,7 +2,7 @@ import React, { useContext } from "react";
import { SqDistributionTag, SqValue, SqValueTag } from "@quri/squiggle-lang"; import { SqDistributionTag, SqValue, SqValueTag } from "@quri/squiggle-lang";
import { NumberShower } from "../NumberShower"; import { NumberShower } from "../NumberShower";
import { DistributionChart, defaultPlot, makePlot } from "../DistributionChart"; import { DistributionChart, defaultPlot, makePlot } from "../DistributionChart";
import { FunctionChart, FunctionChartSettings } from "../FunctionChart"; import { FunctionChart } from "../FunctionChart";
import clsx from "clsx"; import clsx from "clsx";
import { VariableBox } from "./VariableBox"; import { VariableBox } from "./VariableBox";
import { ItemSettingsMenu } from "./ItemSettingsMenu"; import { ItemSettingsMenu } from "./ItemSettingsMenu";
@ -298,7 +298,7 @@ export const ExpressionViewer: React.FC<Props> = ({ value, width }) => {
{() => ( {() => (
<div> <div>
<span>No display for type: </span>{" "} <span>No display for type: </span>{" "}
<span className="font-semibold text-slate-600">{value.tag}</span> <span className="font-semibold text-slate-600">{(value as {tag: string}).tag}</span>
</div> </div>
)} )}
</VariableList> </VariableList>

View File

@ -67,15 +67,17 @@ export const useSquiggle = (args: SquiggleArgs) => {
); );
}, [result, onChange]); }, [result, onChange]);
useEffect(() => { useEffect(
return () => { () => {
if (result.needsClean) args.project.clean(result.sourceName); return () => {
if (args.project.getSource(importSourceName(result.sourceName))) if (result.needsClean) args.project.clean(result.sourceName);
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 },
[]); // eslint-disable-next-line react-hooks/exhaustive-deps
[]
);
return result; return result;
}; };