@elementor/editor-variables 4.2.0-881 → 4.2.0-882

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1076,8 +1076,17 @@ var useVariablesManagerState = () => {
1076
1076
  }, []);
1077
1077
  const handleOnChange = (0, import_react5.useCallback)(
1078
1078
  (newVariables) => {
1079
- setVariables({ ...variables, ...newVariables });
1080
- setIsDirty(true);
1079
+ const hasChanges = Object.entries(newVariables).some(([id, newVar]) => {
1080
+ const existingVar = variables[id];
1081
+ if (!existingVar) {
1082
+ return true;
1083
+ }
1084
+ return existingVar.label !== newVar.label || existingVar.value !== newVar.value || existingVar.order !== newVar.order || existingVar.type !== newVar.type || (existingVar.sync_to_v3 ?? false) !== (newVar.sync_to_v3 ?? false);
1085
+ });
1086
+ if (hasChanges) {
1087
+ setVariables({ ...variables, ...newVariables });
1088
+ setIsDirty(true);
1089
+ }
1081
1090
  },
1082
1091
  [variables]
1083
1092
  );
@@ -1807,7 +1816,7 @@ var VariableRow = (props) => {
1807
1816
  value,
1808
1817
  onChange,
1809
1818
  onPropTypeKeyChange: (type) => {
1810
- if (!isDisabled) {
1819
+ if (!isDisabled && type !== row.type) {
1811
1820
  handleOnChange({
1812
1821
  ...variables,
1813
1822
  [row.id]: { ...variables[row.id], type }