hamzahamidi/ajsf

Nested array, last element controls surfaced data

drewcovi opened this issue · 0 comments

Describe the bug
which template:

  • MaterialDesignFrameworkModule — Material Design
  • Bootstrap3FrameworkModule — Bootstrap 3
  • Bootstrap4FrameworkModule — Bootstrap 4
  • NoFrameworkModule — plain HTML
  • Other (please specify below)

When providing one or multiple nested arrays, it would appears any data prepoulation is limited by the number of fields in the last parent item array.

To Reproduce

  1. Paste the JSON provided and observe the child results across both parent instances.
  2. Adjust the child items in the second parent instance.
  3. Notice that both parents will always have identical children items driven by the second parent whether or not they are prepopulated.

Expected behavior
Both parents should have different prepopulated data based on the provided data.

Screenshots

With layout

with-layout
{
    "schema": {
        "properties": {
            "parents": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "children": {
                            "type": "array",
                            "items": {
                                "type": "number"
                            }
                        }
                    }
                }
            }
        }
    },
    "data": {
            "parents": [
                {
                    "children": [
                        1,
                        2,
                        3,
                        4
                    ]
                },
                {
                    "children": [
                        4
                    ]
                }
            ]
        },
    "layout": [
        {
            "key": "parents",
            "items": [
                    {
                        "key": "parents[].children",
                        "items": [
                            {
                                "key": "parents[].children[]"
                            }
                        ]
                    }
        ]}
    ]
}

Without Layout

without-layout
{
    "schema": {
        "properties": {
            "parents": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "children": {
                            "type": "array",
                            "items": {
                                "type": "number"
                            }
                        }
                    }
                }
            }
        }
    },
    "data": {
            "parents": [
                {
                    "children": [
                        1,
                        2,
                        3,
                        4
                    ]
                },
                {
                    "children": [
                        4
                    ]
                }
            ]
        }
}