Skip to content

Commit

Permalink
create a deep copy snapshot of the output on wait condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Sergeev committed Nov 3, 2023
1 parent eabe547 commit f93c27d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/TemplateProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ export default class TemplateProcessor {
resolve({
"error": {
message: `wait condition ${waitCondition} timed out in ${timeout}ms`,
output: this.output
output: JSON.parse(JSON.stringify(this.output)) // deep copy
}
});
} else {
Expand All @@ -1171,7 +1171,7 @@ export default class TemplateProcessor {
this.removeDataChangeCallback('/');
clearTimeout(timeoutId); // Clear the timeout when condition is met
this.logger.debug(`received data change matching ${waitCondition} for ${jsonPtr} with data ${data}`);
resolve(this.output);
resolve(JSON.parse(JSON.stringify(this.output))); // deep copy
} else {
this.logger.debug(`received data change not matching ${waitCondition} for ${jsonPtr} with data ${data}`);
}
Expand Down

0 comments on commit f93c27d

Please sign in to comment.