[Metrics UI] Fix Inventory View sorting by handling null values (#67889)

* [Metrics UI] Fix Inventory View sorting by handling null values

* Fixing situation where the id is not unique

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Chris Cowan 2020-06-10 17:19:31 -07:00 committed by GitHub
parent 0cfe1166ec
commit 89a6007881
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -44,7 +44,7 @@ export const GroupOfNodes: React.FC<Props> = ({
<Nodes>
{group.nodes.map((node) => (
<Node
key={node.pathId}
key={`${node.pathId}:${node.name}`}
options={options}
squareSize={group.squareSize}
node={node}

View file

@ -10,7 +10,7 @@ import { WaffleSortOption } from '../hooks/use_waffle_options';
const SORT_PATHS = {
name: (node: SnapshotNode) => last(node.path),
value: 'metric.value',
value: (node: SnapshotNode) => node.metric.value || 0,
};
export const sortNodes = (sort: WaffleSortOption, nodes: SnapshotNode[]) => {