Fixing loop when setting variables
Setting a variable would makes the application enter in an infinite loop of events (between all the scripts and the back) This fix makes sure a variable does not emit any event if it is changed to a value it already has.
This commit is contained in:
parent
84df25f863
commit
2aba6b1c27
6 changed files with 61 additions and 23 deletions
|
@ -23,11 +23,11 @@ export const initVariables = (_variables: Map<string, unknown>): void => {
|
|||
|
||||
setVariableResolvers.subscribe((event) => {
|
||||
const oldValue = variables.get(event.key);
|
||||
|
||||
// If we are setting the same value, no need to do anything.
|
||||
if (oldValue === event.value) {
|
||||
// No need to do this check since it is already performed in SharedVariablesManager
|
||||
/*if (JSON.stringify(oldValue) === JSON.stringify(event.value)) {
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
variables.set(event.key, event.value);
|
||||
const subject = variableSubscribers.get(event.key);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue