You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
core: harden setDataAt/unsetDataAt against edge cases
Improvements on top of the lodash/fp/set replacement:
- Store "__proto__" segments as own properties via defineProperty and
traverse own properties only, so such keys neither corrupt the
container's prototype nor get dropped. Clone containers key-by-key
because downleveled object spreads assign instead of define.
- Read the updater's old data with resolveData instead of lodash get,
so reads use the same literal path semantics as writes.
- Fall back to lodash's index heuristic when creating missing
containers without schema type information.
- Match lodash's isIndex semantics with a strict index regex instead
of Number() coercion.
- Avoid strict-mode TypeErrors when unsetting non-index array
properties (e.g. "length") and return the same reference when
there is nothing to unset.
- Treat an empty path as addressing the root, and replace non-object
root data instead of spreading it.
Also documents the path semantics change in MIGRATION.md and adds unit
tests for setDataAt/unsetDataAt.
Copy file name to clipboardExpand all lines: MIGRATION.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,16 @@ return this.t(label, label) as string;
40
40
41
41
This does not affect the Composition API where `Translator` is accessed directly from a `ComputedRef`.
42
42
43
+
### Data update paths treat all segments literally
44
+
45
+
Data updates (e.g. dispatched `update` actions) previously wrote to the form data via lodash's `set`/`unset`, which interpret bracket notation and array indices in paths.
46
+
This corrupted data for property names that look like lodash path syntax, for example numeric property names like `"15"` were turned into array indices and names containing brackets like `"prop[0]"` were split up (see [#2397](https://github.com/eclipsesource/jsonforms/issues/2397) and [#2102](https://github.com/eclipsesource/jsonforms/issues/2102)).
47
+
48
+
Updates now use the new `setDataAt`/`unsetDataAt` utilities of `@jsonforms/core`, which split paths on `.` and treat every segment as a literal property name, matching how JSON Forms resolves values for display.
49
+
When a missing intermediate container is created, the JSON Schema decides whether it becomes an array or an object; without schema type information, a numeric follow-up segment creates an array, as before.
50
+
51
+
If you dispatch update actions yourself, make sure to use dot-separated paths (e.g. `update('list.0.name', ...)`) instead of lodash bracket syntax (e.g. `update('list[0].name', ...)`), which is no longer interpreted.
52
+
43
53
### Angular support now targets Angular 20 to 22
44
54
45
55
When using JSON Forms 3.8, your Angular application now needs to target Angular 20, 21 or 22.
0 commit comments