Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple nested paths only return first path. #55

Open
vikashtank opened this issue Aug 31, 2019 · 2 comments
Open

Multiple nested paths only return first path. #55

vikashtank opened this issue Aug 31, 2019 · 2 comments

Comments

@vikashtank
Copy link

getStateFromCookies function when given the two nested paths only returns a first path.

Input: const paths = {
"authentication.refreshToken": { name: 'refreshToken' },
"authentication.accessToken": { name: 'accessToken' },
};

Call: getStateFromCookies({}, paths}

output: {
authentication: {
accessToken: "fakeToken"
}
}

@mamcgrath
Copy link

It looks like this is due to how to the state objects are merged.
return pathStates.reduce((finalState, pathState) => ({ ...finalState, ...pathState }), preloadedState);
This would not be hard to fix to using lodash merge or JQuery extend although it would add another dependency.
return pathStates.reduce((finalState, pathState) => _.merge({}, finalState, pathState), preloadedState);

@jancama2
Copy link

This was actually fixed in the #56.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants