From bc539c3165493a770e23c10defe7051aaf2b796c Mon Sep 17 00:00:00 2001 From: sam-m-m Date: Fri, 23 Apr 2021 15:09:13 -0700 Subject: [PATCH] feat #300 - Fix JSONPath issues in Table --- src/components/Table/utils.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Table/utils.tsx b/src/components/Table/utils.tsx index 7a4c5f67..16b808ae 100644 --- a/src/components/Table/utils.tsx +++ b/src/components/Table/utils.tsx @@ -106,8 +106,10 @@ export function processData( } const pathArr: string[] = getJSONPathArr(`$.${dataIndex}`) + // Fix for this issue https://github.com/JSONPath-Plus/JSONPath/issues/102 + if (pathArr[0] === '$') pathArr.shift() - if (pathArr && pathArr.length) { + if (pathArr.length) { partialData[pathArr[0] as keyof TableData] = item[pathArr[0]] } })