@syncbridge/common 2.3.0 → 2.3.1
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/app-factory.js +16 -7
- package/constants.d.ts +1 -1
- package/constants.js +1 -1
- package/package.json +1 -1
package/app-factory.js
CHANGED
|
@@ -266,7 +266,13 @@ export var AppFactory;
|
|
|
266
266
|
}
|
|
267
267
|
});
|
|
268
268
|
}
|
|
269
|
-
|
|
269
|
+
/**
|
|
270
|
+
* A running element's values, patched with a new profile's: its hot-plug
|
|
271
|
+
* settings alone - those of a hot-plug group all of them. A list - of
|
|
272
|
+
* values or of groups - is replaced whole, never merged into an object.
|
|
273
|
+
* The paths changed are kept for its 'values-updated' event.
|
|
274
|
+
*/
|
|
275
|
+
function _patchValues(ctx, instance, target, valPath, newValues, newVariables, oldValues, oldVariables, hot = false) {
|
|
270
276
|
if (oldValues)
|
|
271
277
|
Object.assign(target, oldValues);
|
|
272
278
|
const updatedValues = ctx.valueUpdates?.get(instance) || [];
|
|
@@ -274,17 +280,20 @@ export var AppFactory;
|
|
|
274
280
|
if (newVariables) {
|
|
275
281
|
for (const [varKey, varMeta] of Object.entries(newVariables)) {
|
|
276
282
|
const keyPath = valPath ? valPath + '.' + varKey : varKey;
|
|
277
|
-
/** Update only hotplug variables */
|
|
278
|
-
if (varMeta?.hotPlug !== true)
|
|
283
|
+
/** Update only hotplug variables, and all of a hotplug group */
|
|
284
|
+
if (!hot && varMeta?.hotPlug !== true)
|
|
279
285
|
continue;
|
|
280
|
-
if (varMeta.type === 'nested') {
|
|
286
|
+
if (varMeta.type === 'nested' && !varMeta.isArray) {
|
|
281
287
|
target[varKey] = {};
|
|
282
|
-
_patchValues(ctx, instance, target[varKey], keyPath, newValues[varKey], newVariables[varKey]?.variables || {}, oldValues?.[varKey], oldVariables?.[varKey]?.variables);
|
|
288
|
+
_patchValues(ctx, instance, target[varKey], keyPath, newValues?.[varKey], newVariables[varKey]?.variables || {}, oldValues?.[varKey], oldVariables?.[varKey]?.variables, true);
|
|
283
289
|
continue;
|
|
284
290
|
}
|
|
285
|
-
|
|
291
|
+
const value = newValues?.[varKey];
|
|
292
|
+
if (!equal(target[varKey], value)) {
|
|
286
293
|
updatedValues.push(keyPath);
|
|
287
|
-
|
|
294
|
+
/* Its own copy: the profile's left as it is */
|
|
295
|
+
target[varKey] =
|
|
296
|
+
value && typeof value === 'object' ? clone(value) : value;
|
|
288
297
|
}
|
|
289
298
|
}
|
|
290
299
|
}
|
package/constants.d.ts
CHANGED
package/constants.js
CHANGED