Skip to content

Commit

Permalink
[#4099] Fix crash when using legacy Objects API registration
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Apr 3, 2024
1 parent aa8cce3 commit 4360f45
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const onObjectsAPIUserDefinedVariableEdit = (
variable,
originalVariable
) => {
if (registrationBackendOptions.version !== 2) return;
// If the data type has changed, the mapped target might not be compatible anymore:
const shouldRemove = originalVariable == null || variable.dataType !== originalVariable.dataType;

Expand All @@ -23,15 +24,17 @@ const onObjectsAPIUserDefinedVariableEdit = (

if (matchingMappingIndex === -1) return;
registrationBackendOptions.variablesMapping.splice(matchingMappingIndex, 1);
return registrationBackendOptions;
} else {
const keyChanged = variable.key !== originalVariable.key;
if (!keyChanged) return null;
if (!keyChanged) return;

for (const mapping of registrationBackendOptions.variablesMapping) {
if (mapping.variableKey === originalVariable.key) {
mapping.variableKey = variable.key;
}
}
return registrationBackendOptions;
}
};

Expand Down

0 comments on commit 4360f45

Please sign in to comment.