diff --git a/packages/components/src/components/FunctionChart1Dist.tsx b/packages/components/src/components/FunctionChart1Dist.tsx index 16b5ad47..9deeb044 100644 --- a/packages/components/src/components/FunctionChart1Dist.tsx +++ b/packages/components/src/components/FunctionChart1Dist.tsx @@ -172,25 +172,22 @@ export const FunctionChart1Dist: React.FC = ({ const signalListeners = { mousemove: handleHover, mouseout: handleOut }; //TODO: This custom error handling is a bit hacky and should be improved. - let mouseItem: result = !!mouseOverlay - ? fn.call([mouseOverlay]) - : { - tag: "Error", - value: SqError.createOtherError( - "Hover x-coordinate returned NaN. Expected a number." - ), - }; - let showChart = - mouseItem.tag === "Ok" && - mouseItem.value.tag === SqValueTag.Distribution ? ( - - ) : null; + let showChart: JSX.Element | null = null; + if (!isNaN(mouseOverlay)) { + let mouseItem = fn.call([mouseOverlay]); + + showChart = + mouseItem.tag === "Ok" && + mouseItem.value.tag === SqValueTag.Distribution ? ( + + ) : null; + } let getPercentilesMemoized = React.useMemo( () => getPercentiles({ chartSettings, fn, environment }), diff --git a/packages/squiggle-lang/src/rescript/ForTS/ForTS_Reducer_ErrorValue.res b/packages/squiggle-lang/src/rescript/ForTS/ForTS_Reducer_ErrorValue.res index ade7a50f..7e6e666a 100644 --- a/packages/squiggle-lang/src/rescript/ForTS/ForTS_Reducer_ErrorValue.res +++ b/packages/squiggle-lang/src/rescript/ForTS/ForTS_Reducer_ErrorValue.res @@ -19,4 +19,4 @@ let createTodoError = (v: string) => Reducer_ErrorValue.RETodo(v) let createOtherError = (v: string) => Reducer_ErrorValue.REOther(v) @genType -let getErrorSource = (err: reducerErrorValueWithSource) => err.sourceId +let getSource = (err: reducerErrorValueWithSource) => err.sourceId