eadmundo / redux-seamless-immutable

Helpers for using seamless-immutable in Redux
MIT License
46 stars 11 forks source link

Publish a version matching react-router-redux v5 alpha #10

Open Aaronius opened 6 years ago

Aaronius commented 6 years ago

react-router-redux has a v5 alpha that's incompatible with redux-seamless-immutable. It would be fantastic to have a matching alpha of redux-seamless-immutable that worked with it. One incompatibility I'm aware of is the router reducer of v5 alpha sets location instead of locationBeforeTransitions.

Aaronius commented 6 years ago

Here's the code for routerReducer that's compatible with the v5 alpha of react-router-redux:

import Immutable from 'seamless-immutable';
import { LOCATION_CHANGE } from 'react-router-redux';

const initialState = Immutable({
  location: null
});

export function routerReducer(state = initialState, { type, payload } = {}) {
  if (type === LOCATION_CHANGE) {
    return state.set('location', payload);
  }

  return state;
}
SoaresMG commented 5 years ago

You could open a PR for it