This is an automated email from the ASF dual-hosted git repository. emotionbug pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/incubator-age-viewer.git
commit 700a2e280bc0635b946af5efa026a79b48baa74b Author: shinhanbyeol <[email protected]> AuthorDate: Wed Oct 27 17:44:46 2021 +0900 Fix Optional Match Error 1. Correct errors that fail to handle null results when using optical match syntax --- backend/src/services/cypherService.js | 24 ++++++++++++++---------- frontend/src/features/cypher/CypherUtil.js | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/backend/src/services/cypherService.js b/backend/src/services/cypherService.js index a6b1adc..f6398fa 100644 --- a/backend/src/services/cypherService.js +++ b/backend/src/services/cypherService.js @@ -52,7 +52,7 @@ class CypherService { try { cypherRow = this._convertRowToResult(targetItem) } catch (e) { - console.error("FixMe!") + console.error("FixMe: _convertRowToResult error") } } result = { @@ -80,16 +80,20 @@ class CypherService { return resultSet.rows.map((row) => { let convetedObject = {}; for (let k in row) { - let typeName = row[k].constructor.name; - if (typeName === 'Path') { - convetedObject[k] = this.convertPath(row[k]); - } else if (typeName === 'Vertex') { - convetedObject[k] = this.convertVertex(row[k]); - } else if (typeName === 'Edge') { - convetedObject[k] = this.convertEdge(row[k]); + if (row[k]) { + let typeName = row[k].constructor.name; + if (typeName === 'Path') { + convetedObject[k] = this.convertPath(row[k]); + } else if (typeName === 'Vertex') { + convetedObject[k] = this.convertVertex(row[k]); + } else if (typeName === 'Edge') { + convetedObject[k] = this.convertEdge(row[k]); + } else { + convetedObject[k] = row[k]; + } } else { - convetedObject[k] = row[k]; - } + convetedObject[k] = null; + } } return convetedObject; }); diff --git a/frontend/src/features/cypher/CypherUtil.js b/frontend/src/features/cypher/CypherUtil.js index b09324f..2e03d48 100644 --- a/frontend/src/features/cypher/CypherUtil.js +++ b/frontend/src/features/cypher/CypherUtil.js @@ -391,7 +391,7 @@ export const generateCytoscapeElement = (data, maxDataOfGraph, isNew) => { const [pathAlias, pathVal] = valueEntry; generateElements(pathAlias, pathVal); }); - } else { + } else if (val) { generateElements(alias, val); } });
