Why:
Changing a deeply nested property is more complex, error prone, and takes more time to execute. Deeply nested state models are harder to understand too. It will also require changing all parent objects and arrays that contain the changed value which potentially causes more UI renders and/or more tests whether component properties changed.
How:
Go back to former design where initial contributions that stay constant are separate from changing contribution states and components.
export interface StoreState {
...
contributionsResult: ApiResult<Contributions>;
contribInfosRecord: Record<string, ContributionInfo[]>;
contribComponentsRecord: Record<string, ComponentState[]>;
contribStatesRecord: Record<string, ContributionState[]>;
}
This will help implementing #21 because we can then listen for changes in contribStatesRecord only (subscribe with selector).
Why:
Changing a deeply nested property is more complex, error prone, and takes more time to execute. Deeply nested state models are harder to understand too. It will also require changing all parent objects and arrays that contain the changed value which potentially causes more UI renders and/or more tests whether component properties changed.
How:
Go back to former design where initial contributions that stay constant are separate from changing contribution states and components.
This will help implementing #21 because we can then listen for changes in
contribStatesRecordonly (subscribe with selector).