Skip to content

Commit 69adfc3

Browse files
Fixed an issue where named expressions added on engine initialization were not updated on changes (#1521)
* Add unit tests for the issue * fix(named-expressions): mark named expressions as dirty before re-computation (#1504) * Add changelog entry * Add unit tests for named expressions created on initialization * Change order of operations on engine initialization to make initial named expression array work correctly --------- Co-authored-by: Esmail Rahmani <60963312+Esmail-Rahmani@users.noreply.github.com>
1 parent d3ac97a commit 69adfc3

File tree

3 files changed

+1656
-899
lines changed

3 files changed

+1656
-899
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1111

1212
- Fixed `Edge does not exist` error when a named expression is used twice in the same formula. [#1102](https://github.com/handsontable/hyperformula/issues/1102)
1313
- Fixed typos in the built-in functions guide. [#1517](https://github.com/handsontable/hyperformula/issues/1517)
14+
- Fixed an issue where named expressions added on engine initialization were not updated on changes. [#1501](https://github.com/handsontable/hyperformula/issues/1501)
1415

1516
## [3.0.0] - 2025-01-14
1617

src/BuildEngineFactory.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ export class BuildEngineFactory {
105105
lazilyTransformingAstService.undoRedo = undoRedo
106106
const clipboardOperations = new ClipboardOperations(config, dependencyGraph, operations)
107107
const crudOperations = new CrudOperations(config, operations, undoRedo, clipboardOperations, dependencyGraph, columnSearch, parser, cellContentParser, lazilyTransformingAstService, namedExpressions)
108-
inputNamedExpressions.forEach((entry: SerializedNamedExpression) => {
109-
crudOperations.ensureItIsPossibleToAddNamedExpression(entry.name, entry.expression, entry.scope)
110-
crudOperations.operations.addNamedExpression(entry.name, entry.expression, entry.scope, entry.options)
111-
})
112108

113109
const exporter = new Exporter(config, namedExpressions, sheetMapping.fetchDisplayName, lazilyTransformingAstService)
114110
const serialization = new Serialization(dependencyGraph, unparser, exporter)
@@ -120,6 +116,11 @@ export class BuildEngineFactory {
120116
graphBuilder.buildGraph(sheets, stats)
121117
})
122118

119+
inputNamedExpressions.forEach((entry: SerializedNamedExpression) => {
120+
crudOperations.ensureItIsPossibleToAddNamedExpression(entry.name, entry.expression, entry.scope)
121+
crudOperations.operations.addNamedExpression(entry.name, entry.expression, entry.scope, entry.options)
122+
})
123+
123124
const evaluator = new Evaluator(config, stats, interpreter, lazilyTransformingAstService, dependencyGraph, columnSearch)
124125
evaluator.run()
125126

0 commit comments

Comments
 (0)