@xmachines/json-render-react 0.21.0-xm.6 → 0.23.1-xm.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/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -2
package/dist/index.mjs
CHANGED
|
@@ -1627,11 +1627,9 @@ function defineRegistry(catalog, options) {
|
|
|
1627
1627
|
const result = {};
|
|
1628
1628
|
for (const [name, actionFn] of actionMap) {
|
|
1629
1629
|
result[name] = async (params) => {
|
|
1630
|
-
const setState = getSetState();
|
|
1630
|
+
const setState = getSetState() ?? (() => void 0);
|
|
1631
1631
|
const state = getState();
|
|
1632
|
-
|
|
1633
|
-
await actionFn(params, setState, state);
|
|
1634
|
-
}
|
|
1632
|
+
await actionFn(params, setState, state);
|
|
1635
1633
|
};
|
|
1636
1634
|
}
|
|
1637
1635
|
return result;
|
|
@@ -2016,6 +2014,9 @@ function isSpecDataPart(data) {
|
|
|
2016
2014
|
return false;
|
|
2017
2015
|
}
|
|
2018
2016
|
}
|
|
2017
|
+
function cloneJson(value) {
|
|
2018
|
+
return JSON.parse(JSON.stringify(value));
|
|
2019
|
+
}
|
|
2019
2020
|
function buildSpecFromParts(parts) {
|
|
2020
2021
|
const spec = { root: "", elements: {} };
|
|
2021
2022
|
let hasSpec = false;
|
|
@@ -2025,13 +2026,13 @@ function buildSpecFromParts(parts) {
|
|
|
2025
2026
|
const payload = part.data;
|
|
2026
2027
|
if (payload.type === "patch") {
|
|
2027
2028
|
hasSpec = true;
|
|
2028
|
-
applySpecPatch(spec, payload.patch);
|
|
2029
|
+
applySpecPatch(spec, cloneJson(payload.patch));
|
|
2029
2030
|
} else if (payload.type === "flat") {
|
|
2030
2031
|
hasSpec = true;
|
|
2031
|
-
Object.assign(spec, payload.spec);
|
|
2032
|
+
Object.assign(spec, cloneJson(payload.spec));
|
|
2032
2033
|
} else if (payload.type === "nested") {
|
|
2033
2034
|
hasSpec = true;
|
|
2034
|
-
const flat = nestedToFlat(payload.spec);
|
|
2035
|
+
const flat = nestedToFlat(cloneJson(payload.spec));
|
|
2035
2036
|
Object.assign(spec, flat);
|
|
2036
2037
|
}
|
|
2037
2038
|
}
|