Merge pull request #524 from quantified-uncertainty/react-keys

Add react keys to remove warnings
This commit is contained in:
Sam Nolan 2022-05-13 11:47:34 -04:00 committed by GitHub
commit d31619baa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -145,10 +145,10 @@ export const FunctionChart: React.FC<FunctionChartProps> = ({
/> />
{showChart} {showChart}
{_.entries(groupedErrors).map(([errorName, errorPoints]) => ( {_.entries(groupedErrors).map(([errorName, errorPoints]) => (
<ErrorBox heading={errorName}> <ErrorBox key={errorName} heading={errorName}>
Values:{" "} Values:{" "}
{errorPoints {errorPoints
.map((r) => <NumberShower number={r.x} />) .map((r, i) => <NumberShower key={i} number={r.x} />)
.reduce((a, b) => ( .reduce((a, b) => (
<> <>
{a}, {b} {a}, {b}

View File

@ -148,8 +148,9 @@ const SquiggleItem: React.FC<SquiggleItemProps> = ({
case "array": case "array":
return ( return (
<VariableBox heading="Array" showTypes={showTypes}> <VariableBox heading="Array" showTypes={showTypes}>
{expression.value.map((r) => ( {expression.value.map((r, i) => (
<SquiggleItem <SquiggleItem
key={i}
expression={r} expression={r}
width={width !== undefined ? width - 20 : width} width={width !== undefined ? width - 20 : width}
height={50} height={50}
@ -166,7 +167,7 @@ const SquiggleItem: React.FC<SquiggleItemProps> = ({
return ( return (
<VariableBox heading="Record" showTypes={showTypes}> <VariableBox heading="Record" showTypes={showTypes}>
{Object.entries(expression.value).map(([key, r]) => ( {Object.entries(expression.value).map(([key, r]) => (
<> <div key={key}>
<RecordKeyHeader>{key}</RecordKeyHeader> <RecordKeyHeader>{key}</RecordKeyHeader>
<SquiggleItem <SquiggleItem
expression={r} expression={r}
@ -178,14 +179,14 @@ const SquiggleItem: React.FC<SquiggleItemProps> = ({
chartSettings={chartSettings} chartSettings={chartSettings}
environment={environment} environment={environment}
/> />
</> </div>
))} ))}
</VariableBox> </VariableBox>
); );
case "arraystring": case "arraystring":
return ( return (
<VariableBox heading="Array String" showTypes={showTypes}> <VariableBox heading="Array String" showTypes={showTypes}>
{expression.value.map((r) => `"${r}"`)} {expression.value.map((r) => `"${r}"`).join(", ")}
</VariableBox> </VariableBox>
); );
case "lambda": case "lambda":