diff --git a/packages/components/src/components/DistributionChart.tsx b/packages/components/src/components/DistributionChart.tsx index e2e92591..4ff4d9fd 100644 --- a/packages/components/src/components/DistributionChart.tsx +++ b/packages/components/src/components/DistributionChart.tsx @@ -6,7 +6,7 @@ import { distributionErrorToString } from "@quri/squiggle-lang"; import { createClassFromSpec } from "react-vega"; import * as chartSpecification from "../vega-specs/spec-distributions.json"; import { ErrorBox } from "./ErrorBox"; -import { useSize } from 'react-use'; +import { useSize } from "react-use"; let SquiggleVegaChart = createClassFromSpec({ spec: chartSpecification as Spec, @@ -23,28 +23,29 @@ export const DistributionChart: React.FC = ({ height, width, }: DistributionChartProps) => { - const [sized, _] = useSize((size) => { - let shape = distribution.pointSet(); - let widthProp = width !== undefined ? width - 20 : size.width - 10; - if (shape.tag === "Ok") { - return (
- -
+ let shape = distribution.pointSet(); + let widthProp = width !== undefined ? width - 20 : size.width - 10; + if (shape.tag === "Ok") { + return ( +
+ +
); - } else { - return (
- - {distributionErrorToString(shape.value)} - -
- ) - } - }) - return sized; + } else { + return ( +
+ + {distributionErrorToString(shape.value)} + +
+ ); + } + }); + return sized; }; diff --git a/packages/components/src/components/SquiggleChart.tsx b/packages/components/src/components/SquiggleChart.tsx index 652db5cb..db8e12c2 100644 --- a/packages/components/src/components/SquiggleChart.tsx +++ b/packages/components/src/components/SquiggleChart.tsx @@ -121,7 +121,7 @@ const SquiggleItem: React.FC = ({ {key}