Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Field value type changes from array to object after child validation #726

Open
@jmaicher

Description

@jmaicher

The Problem

I have a custom component that handles a list of items. This component is connected and, given a model string as prop, gets the field value from the form state to render its children.

When any of the child components is validated and has errors (rrf/setErrors), the parent field value changes from being an array [x, y, z] to { 0: x, 1: y, 2: z }.

This change was introduced with 1.8.1 and looks like a bug to me.

In general, is it wise to rely on the field value at all? I want this component to be reusable with a dynamic model. As alternative (and current workaround) I could extract the model value from the model state instead of the form state (e.g. with lodash.get). Or is there a simpler way while preserving the props interface (I want to avoid having to pass the model value via props as it looks redundant to me).

<EmailArrayControl model="user.emails" />
<EmailArrayControl model="company.employees[0].emails" />

Steps to Reproduce

See: http://codepen.io/jmaicher/pen/ryqPPZ

Expected Behavior

The field value remains an array [x, y, z].

Actual Behavior

The field value becomes an object { 0: x, 1: y, 2: z }.

Reproducible Code Example

http://codepen.io/jmaicher/pen/ryqPPZ

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions