acdlite / redux-router

Redux bindings for React Router – keep your router state inside your Redux store
MIT License
2.3k stars 216 forks source link

2.0.0-beta-1: stringifyQuery and parseQueryString #254

Closed ianks closed 8 years ago

ianks commented 8 years ago

I managed to get stringifyQuery and parseQuery string to work properly in 2.0.0-beta-1 by doing something like this:

const useRouterHistory = require('react-router').useRouterHistory;
const createHistory = require('history/lib/createBrowserHistory');
const createAppHistory = useRouterHistory(createHistory);

const appHistory = () => {
  return createAppHistory({
    stringifyQuery: qs.stringify,
    parseQueryString: qs.parse,
  });
};

const middleware = [
  reduxReactRouter({
    createHistory: appHistory,
  }),
];

export const baseMiddleware = compose(...middleware);

const Store = baseMiddleware(createStore)(rootReducer);

Everything seems to work fine. Query strings are parsed and serialized using the provided qs.parse and qs.stringify; however, the console gives me countless warnings about:

browser.js:49 Warning: useQueries does not stringify nested query objects by default; use a custom stringifyQuery function

Does anyone know a better way to achieve what I am trying to do which will not trigger warnings?

ianks commented 8 years ago

This will be solved by #255

Scarysize commented 8 years ago

Thanks for your PR :-)