From 4cf1d005cdda7207962e619e59ae6a8808250bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9B=A7=E5=9B=A7?= Date: Tue, 10 Oct 2023 07:12:18 -0500 Subject: [PATCH] Fix rescursive rel (#13) * Fix recursive rel property rendering * Force dev mode for npm serve --- package.json | 2 +- src/components/ShellView/ResultGraph.vue | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 936729c..ce1647d 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "serve": "nodemon --exec \"vue-cli-service serve\"", + "serve": "NODE_ENV=development nodemon --exec \"vue-cli-service serve\"", "serve-prod": "NODE_ENV=production node src/server/index.js", "build": "KUZU_PATH=. vue-cli-service build", "lint": "vue-cli-service lint", diff --git a/src/components/ShellView/ResultGraph.vue b/src/components/ShellView/ResultGraph.vue index 981ffa1..c9cdb13 100644 --- a/src/components/ShellView/ResultGraph.vue +++ b/src/components/ShellView/ResultGraph.vue @@ -416,36 +416,38 @@ export default { for (let key in row) { switch (dataTypes[key]) { case DATA_TYPES.NODE: { - const node = row[key]; + const node = { ...row[key] }; processNode(node); break; } case DATA_TYPES.REL: { - const rel = row[key]; + const rel = { ...row[key] }; processRel(rel); break; } case DATA_TYPES.RECURSIVE_REL: { - const recursiveRel = row[key]; + const recursiveRel = { ...row[key] }; recursiveRel._nodes.forEach((node) => { + node = { ...node }; const nodeId = this.encodeNodeId(node._id); if (nodes[nodeId]) { return; } for (let key in node) { - if (!node[key]) { + if (node[key] === null || node[key] === undefined) { delete node[key]; } } processNode(node); }); recursiveRel._rels.forEach((rel) => { + rel = { ...rel }; const relId = this.encodeRelId(rel._src, rel._dst); if (edges[relId]) { return; } for (let key in rel) { - if (!rel[key]) { + if (rel[key] === null || rel[key] === undefined) { delete rel[key]; } }