Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
},
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@defra/forms-model": "^3.0.552",
"@defra/forms-model": "^3.0.555",
"@defra/hapi-tracing": "^1.26.0",
"@elastic/ecs-pino-format": "^1.5.0",
"@hapi/boom": "^10.0.1",
Expand Down
15 changes: 8 additions & 7 deletions src/server/plugins/engine/models/FormModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,10 @@ export class FormModel {
// Add page to context
context.relevantPages.push(nextPage)

this.assignEvaluationState(context, nextPage)
// Engine.V2 is excluded here as this will have already been done in initialiseContext()
if (this.engine !== Engine.V2) {
this.assignEvaluationState(context, nextPage)
}

this.assignRelevantState(context, nextPage)

Expand All @@ -389,14 +392,12 @@ export class FormModel {
}

private initialiseContext(context: FormContext) {
// For the V2 engine, we need to initialise `evaluationState` to null
// for all keys. This is because the current condition evaluation
// library (eval-expr) will throw if an expression uses a key that is undefined.
// For the V2 engine, we initialise `evaluationState` for all keys.
// This is because the current condition evaluation library (eval-expr)
// will throw if an expression uses a key that is undefined.
if (this.engine === Engine.V2) {
for (const page of this.pages) {
for (const key of page.keys) {
context.evaluationState[key] = null
}
this.assignEvaluationState(context, page)
}
}
}
Expand Down
Loading
Loading