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.

Nested models fail when a change/load action is the first action for a model path. #801

Open
@caesay

Description

@caesay

Problem

Given model quote.Applicant.Details.FirstName (text field).

If a rrf/focus action is sent first, the redux state looks like this:

{
    quoteForm: {
        $form: { ... },
        Applicant: {
            $form: { ... },
            Details: {
                $form: { ... },
                FirstName: {
                    focus: true,
                    ...
                }
            }
        }
    }
}

Note here that a $form entry was added at every level of the state.

Now, if a rff/change action is sent first, the model will look like this:

{
    quoteForm: {
        $form: { ... },
        Applicant: {
            Details: {
                FirstName: {
                    value: "",
                    ...
                }
            }
        }
    }
}

Note that $form is missing here at every level except for the top level. Playing with silent, load options yield the same results. At this point the form is now broken and no subsequent actions will create the missing $form fields. Calls to getField for those models (such as quote.Applicant) will now always return the initial state and be inaccurate.

Expectation

I would expect that I should be able to pre-populate any part of my model with a change/load action without breaking things.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions