ui: filterMinorPaths -> return input data if nodes arr. is empty

This commit is contained in:
nick-delirium 2024-12-26 09:21:45 +01:00
parent e719a1bdc0
commit 3c82b135cb
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0
2 changed files with 8 additions and 3 deletions

View file

@ -100,7 +100,7 @@ export const CARD_LIST: CardType[] = [
example: HeatmapsExample
},
{
title: 'Path Finder',
title: 'Journey',
key: USER_PATH,
cardType: USER_PATH,
category: CARD_CATEGORIES[0].key,

View file

@ -20,8 +20,13 @@ interface DataNode {
avgTimeFromPrevious: any,
id: string,
}
export function filterMinorPaths(data: { links: Link[], nodes: DataNode[] }, startNode: number = 0): Data {
const original: { links: Link[], nodes: DataNode[] } = JSON.parse(JSON.stringify(data));
interface DataType { links: Link[], nodes: DataNode[] }
export function filterMinorPaths(data: DataType, startNode: number = 0): DataType {
if (!data.nodes.length || !data.links.length) {
return data;
}
const original: DataType = JSON.parse(JSON.stringify(data));
const eventType = data.nodes[startNode].eventType;
const sourceLinks: Map<number, Link[]> = new Map();
for (const link of original.links) {