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

add stateMergeFunction to config #100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

pedep
Copy link

@pedep pedep commented Sep 6, 2018

The solution mentioned in #65

Alternative solution to this problem posted in #94

@@ -246,7 +246,7 @@ export const localStorageSync = (config: LocalStorageConfig) => (
(action.type === INIT_ACTION || action.type === UPDATE_ACTION) &&
rehydratedState
) {
state = Object.assign({}, state, rehydratedState);
state = config.stateMergeFunction ? config.stateMergeFunction(state, rehydratedState) : Object.assign({}, state, rehydratedState);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case project maintainers decide to accept this concept, this ternary should instead check whether config.stateMergeFunction is callable: typeof config.stateMergeFunction === 'function'

@rowandh rowandh mentioned this pull request Oct 10, 2019
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

Successfully merging this pull request may close these issues.

2 participants