Skip to content

Partial Store Shadowing #6

@objectliteral

Description

@objectliteral

Currently a component with state interacts with the closest store that is connect to on of the component's ancestors. This is probably what the user wants in some cases, but it is a all-or-nothing: None of the keys from other stores are available.

Expectation: It would be nice, if the closer store does not completely shadow others, but that the shadowing takes place on the level of individual keys.

Example

const Child = withState('foo')(({foo, answer}) => {
    return (
        <div>{`foo: ${foo} and answer: ${answer}`}</div>
    );
});

const Father = connect(() => {
    return (
        <Child />
    )
}, { foo: 'bazzz' });

const App = () => {
    return (
        <Father>
            <Child />
        </Father>
    )
}

const Grandfather = connect(App, { foo: 'bar', answer: 42 });

This currently renders "foo: bazzz and answer: undefined" because Child only has access to the nearest store. With partial store shadowing, this example should render "foo: bazzz and answer: 42".

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions