From 93ad18c4bb7c15854ad31ac3f530d87df5874453 Mon Sep 17 00:00:00 2001 From: Soroush Saffari Date: Fri, 19 Jun 2020 12:20:17 +0100 Subject: [PATCH] Fixes a bug where `getRule` gets run on a joint explanation (#300) ## What is the goal of this PR? Explanation now works as expected when the first explanation is joint. This marks the 1.3.1 release. ## What are the changes implemented in this PR? While introducing this fix I came to realise that the _unassigned variables_ error message will not be displayed when the target explanation is within the answers of the joint explanation. I have created an issue for it with high priority: https://github.com/graknlabs/workbase/issues/299 --- VERSION | 2 +- package.json | 2 +- src/renderer/components/Visualiser/store/actions.js | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 589268e6f..6261a05bb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.0 \ No newline at end of file +1.3.1 \ No newline at end of file diff --git a/package.json b/package.json index f70eacb6e..73a3efb8b 100644 --- a/package.json +++ b/package.json @@ -165,5 +165,5 @@ "prebuild": "node version.js", "unit": "node ./node_modules/jest/bin/jest.js ./test/unit" }, - "version": "1.3.0" + "version": "1.3.1" } \ No newline at end of file diff --git a/src/renderer/components/Visualiser/store/actions.js b/src/renderer/components/Visualiser/store/actions.js index 49fd1aa09..958a3c713 100644 --- a/src/renderer/components/Visualiser/store/actions.js +++ b/src/renderer/components/Visualiser/store/actions.js @@ -225,9 +225,11 @@ export default { const explanation = await node.explanation(); - const when = await (await explanation.getRule()).getWhen(); - const relRegex = /(\$[^\s]*|;|{)(\s*?\(.*?\))/g; + let isRelUnassigned = false; + const rule = await explanation.getRule(); + const when = rule && await rule.getWhen(); + const relRegex = /(\$[^\s]*|;|{)(\s*?\(.*?\))/g; let relMatches = relRegex.exec(when); while (relMatches) { if (!relMatches[1].includes('$')) {