Skip to content

Commit

Permalink
feat #300 - Fix JSONPath issues in Table
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-dassana committed Apr 23, 2021
1 parent 189b810 commit bc539c3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/Table/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ export function processData<TableData extends DataId>(
}

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]]
}
})
Expand Down

0 comments on commit bc539c3

Please sign in to comment.