Skip to content

Commit 93ad18c

Browse files
author
Soroush Saffari
authored
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: #299
1 parent a477980 commit 93ad18c

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.0
1+
1.3.1

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,5 +165,5 @@
165165
"prebuild": "node version.js",
166166
"unit": "node ./node_modules/jest/bin/jest.js ./test/unit"
167167
},
168-
"version": "1.3.0"
168+
"version": "1.3.1"
169169
}

src/renderer/components/Visualiser/store/actions.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,11 @@ export default {
225225

226226
const explanation = await node.explanation();
227227

228-
const when = await (await explanation.getRule()).getWhen();
229-
const relRegex = /(\$[^\s]*|;|{)(\s*?\(.*?\))/g;
228+
230229
let isRelUnassigned = false;
230+
const rule = await explanation.getRule();
231+
const when = rule && await rule.getWhen();
232+
const relRegex = /(\$[^\s]*|;|{)(\s*?\(.*?\))/g;
231233
let relMatches = relRegex.exec(when);
232234
while (relMatches) {
233235
if (!relMatches[1].includes('$')) {

0 commit comments

Comments
 (0)