Use fragments instead of arrays when returning elements
Summary: Returning arrays from render kills react-reconciliation and produces missing key warnings. Turned all array rendering methods to use Fragments, where I could find them. Reviewed By: jknoxville Differential Revision: D21178253 fbshipit-source-id: 85ddf8adfa79732ccbe68409fdcf150399455983
This commit is contained in:
committed by
Facebook GitHub Bot
parent
67412bfb43
commit
f07d898a35
@@ -566,12 +566,17 @@ class DataDescriptionContainer extends Component<{
|
||||
return <UndefinedValue>(not set)</UndefinedValue>;
|
||||
} else if (colorInfo) {
|
||||
const {a, b, g, r} = colorInfo;
|
||||
return [
|
||||
<ColorBox key="color-box" color={`rgba(${r}, ${g}, ${b}, ${a})`} />,
|
||||
<ColorValue key="value">
|
||||
rgba({r}, {g}, {b}, {a === 1 ? '1' : a.toFixed(2)})
|
||||
</ColorValue>,
|
||||
];
|
||||
return (
|
||||
<>
|
||||
<ColorBox
|
||||
key="color-box"
|
||||
color={`rgba(${r}, ${g}, ${b}, ${a})`}
|
||||
/>
|
||||
<ColorValue key="value">
|
||||
rgba({r}, {g}, {b}, {a === 1 ? '1' : a.toFixed(2)})
|
||||
</ColorValue>
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
return <span>Malformed color</span>;
|
||||
}
|
||||
@@ -583,12 +588,17 @@ class DataDescriptionContainer extends Component<{
|
||||
return <UndefinedValue>(not set)</UndefinedValue>;
|
||||
} else if (colorInfo) {
|
||||
const {a, b, g, r} = colorInfo;
|
||||
return [
|
||||
<ColorBox key="color-box" color={`rgba(${r}, ${g}, ${b}, ${a})`} />,
|
||||
<ColorValue key="value">
|
||||
rgba({r}, {g}, {b}, {a === 1 ? '1' : a.toFixed(2)})
|
||||
</ColorValue>,
|
||||
];
|
||||
return (
|
||||
<>
|
||||
<ColorBox
|
||||
key="color-box"
|
||||
color={`rgba(${r}, ${g}, ${b}, ${a})`}
|
||||
/>
|
||||
<ColorValue key="value">
|
||||
rgba({r}, {g}, {b}, {a === 1 ? '1' : a.toFixed(2)})
|
||||
</ColorValue>
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
return <span>Malformed color</span>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user