redux-state-sync icon indicating copy to clipboard operation
redux-state-sync copied to clipboard

Default individual values in createStateSyncMiddleware

Open JonathanLorimer opened this issue 4 years ago • 1 comments

export const createStateSyncMiddleware = (config = defaultConfig) => {
    const allowed = isActionAllowed(config);
    const channel = new BroadcastChannel(config.channel, config.broadcastChannelOption);
    const prepareState = config.prepareState || defaultConfig.prepareState;
    let messageListener = null;

the above only defaults to the defaultConfig if no config option is provided. I want to do something like this

const stateSyncMiddleware = createStateSyncMiddleware({
    whitelist: [ActionToWhitelist],
  })

I think it makes sense to default the rest of the values if only one is provided.

JonathanLorimer avatar Jul 29 '20 15:07 JonathanLorimer

All tests are passing, and this change should be backwards compatible!

JonathanLorimer avatar Jul 29 '20 17:07 JonathanLorimer