angular-redux / store

Angular 2+ bindings for Redux
MIT License
1.34k stars 202 forks source link

Problems with setIn... #246

Closed windischb closed 7 years ago

windischb commented 8 years ago

Hi!

I'll have problems to set a property with a new value...

My state looks like this:

export interface ISettings {
    SignalR: {
        connect: boolean
    }
}

export interface IAppState {
    Settings?: settings.ISettings;
}

and in my Reducer i want to set the Property "connect" in to true return state.setIn(["SignalR","connect"], value)

All i'll get is an Error wich says: "invalid keyPath at invariant"

Whats wrong???

SethDavenport commented 8 years ago

Looks like there's something funky with the way you're using ImmutableJS - can you post the code of your reducer?

windischb commented 7 years ago

I'll create the reducer in the same Example as in #244... Thanks!

SethDavenport commented 7 years ago

@windischb I downloaded and ran the front-end portion of the example and I can't reproduce the error.

I wasn't running the backend because I'm not equipped to run C# on this machine. But hitting the 'not working' buttons succeeds in updating state.SignalR.connect properly in my store.

Random guess - can you try an rm -rf node_modules; npm cache clean; npm install just to rule out any package dependency issues?

windischb commented 7 years ago

Hmm... Thats strange.... The Error only occures if you hit the "not working" button at first. No other button before or reload the Page. I'll test your proposal as soon as possible!

SethDavenport commented 7 years ago

OK yeah I can repro now. Sorry I missed that detail

SethDavenport commented 7 years ago

See my comment on #244