Skip to content

Commit 1616bf2

Browse files
Merge pull request #2609 from darius-lesch/resolve/pr-2585-change-requests
Resolve PR #2585 Change Requests
2 parents 5545814 + da9df95 commit 1616bf2

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

MIGRATION.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Migration guide
22

3+
## Migration to JSON Forms 3.9
4+
5+
### Data update paths treat all segments literally
6+
7+
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.
8+
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)).
9+
10+
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.
11+
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.
12+
13+
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.
14+
315
## Migrating to JSON Forms 3.8
416

517
### `Translator` type changed from overloaded signatures to a generic conditional type
@@ -40,16 +52,6 @@ return this.t(label, label) as string;
4052

4153
This does not affect the Composition API where `Translator` is accessed directly from a `ComputedRef`.
4254

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-
5355
### Angular support now targets Angular 20 to 22
5456

5557
When using JSON Forms 3.8, your Angular application now needs to target Angular 20, 21 or 22.

packages/core/src/util/setData.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ const cloneContainer = (data: any): any => {
9595
* properties like `__proto__`, mirroring the semantics of `resolveData`.
9696
*/
9797
const ownPropertyValue = (data: any, segment: string): any =>
98-
data != null && Object.prototype.hasOwnProperty.call(data, segment)
98+
data !== null &&
99+
data !== undefined &&
100+
Object.prototype.hasOwnProperty.call(data, segment)
99101
? data[segment]
100102
: undefined;
101103

0 commit comments

Comments
 (0)