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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user