respond-framework / rudy

Rudy Router - MVC style route async controller for react-redux applications.
MIT License
80 stars 8 forks source link

firstRoute is not a serializable Action #77

Open pjnovas opened 4 years ago

pjnovas commented 4 years ago

I'm getting an error from redux as soon as I dispatch firstRoute Action, I guess it's because commit inside it is a function/ promise to render react after it.

index.js:1 A non-serializable value was detected in an action, in the path: `commit`. Value: ƒ (action) {
        if (committed) return Promise.resolve();
        committed = true;
        return Promise.resolve(commit(action)).then(function () {
          if (!_this8.options.save) return;

  … 
Take a look at the logic that dispatched this action:  {type: "HOME", params: {…}, query: {…}, hash: "", state: {…}, …} 

It tells me to see: https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants

Is there a workaround? or another way of lifting the router without dispatching a non serializable action?

After that everything seems to work fine. Thanks!

pjnovas commented 4 years ago

I've found a workaround for this error which I describe below for anyone else, but firstRouter() should be a serializable action, right?

If you are using redux-starter-kit, you can turn off this error by setting serializableCheck to false as option for getDefaultMiddleware.

More info