@yahoo/uds-create-config 5.72.0 → 5.72.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.
|
@@ -101,7 +101,8 @@ function graftSlotContent({ spec, hostKey, prop, into, elements: content }) {
|
|
|
101
101
|
const host = spec.elements[hostKey];
|
|
102
102
|
if (!host) return spec;
|
|
103
103
|
const prefix = `${hostKey}__${prop}__`;
|
|
104
|
-
const
|
|
104
|
+
const isGrafted = (key) => key.startsWith(prefix) && /^\d/.test(key.slice(prefix.length));
|
|
105
|
+
const kept = Object.fromEntries(Object.entries(spec.elements).filter(([key]) => !isGrafted(key)));
|
|
105
106
|
const grafted = {};
|
|
106
107
|
const used = new Set(Object.keys(kept));
|
|
107
108
|
const roots = content.map((node, index) => {
|
|
@@ -113,7 +114,7 @@ function graftSlotContent({ spec, hostKey, prop, into, elements: content }) {
|
|
|
113
114
|
return built.root;
|
|
114
115
|
});
|
|
115
116
|
const current = host.slots?.[into];
|
|
116
|
-
if (current !== void 0 && current.length === roots.length && roots.every((root, index) => current[index] === root) && Object.keys(spec.elements).filter(
|
|
117
|
+
if (current !== void 0 && current.length === roots.length && roots.every((root, index) => current[index] === root) && Object.keys(spec.elements).filter(isGrafted).length === Object.keys(grafted).length && Object.entries(grafted).every(([key, element]) => JSON.stringify(spec.elements[key]) === JSON.stringify(element))) return spec;
|
|
117
118
|
return {
|
|
118
119
|
...spec,
|
|
119
120
|
elements: {
|