React-redux-firebase: bug(core): non-serializable value detected in a login action using redux-starter-kit

Created on 10 Sep 2019  路  7Comments  路  Source: prescottprue/react-redux-firebase

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Using redux-starter-kit in my program, this library alerts me after a successful login that an non-serializable value is detected in the action @@reactReduxFirebase/LOGIN:

Screenshot_20190910_160832

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via codesandbox or similar.

Setup an simple auth application using redux-starter-kit with the store configured as follow:

import { configureStore } from "redux-starter-kit"

import firebase from "firebase/app"
import "firebase/auth"
import "firebase/firestore"
import { createFirestoreInstance } from "redux-firestore"

firebase.initializeApp(myFirebaseConfig)
firebase.firestore()

const store = configureStore({
  reducer: myAppReducer,
})

export const rrfProps = {
  firebase,
  config: {
    userProfile: 'users',
    useFirestoreForProfile: true,
  },
  dispatch: store.dispatch,
  createFirestoreInstance
}
<Provider store={appStore}>
  <ReactReduxFirebaseProvider {...rrfProps}>
    <MyApp />
  </ReactReduxFirebaseProvider>
</Provider>

What is the expected behavior?

Should the library use only serializable object into Redux action? That is expected by Redux FAQ. Or should I make an exception for this specific case?

Which versions of dependencies, and which browser and OS are affected by this issue? Did this work in previous versions or setups?

OS: Manjaro Linux (last stable version)
Browser: Firefox 69.0 (64-bit)
Package versions:

  • "react": "^16.8.6"
  • "react-firebaseui": "^4.0.0"
  • "react-redux": "^7.1.0"
  • "react-redux-firebase": "^3.0.0-beta.2"
  • "react-router-dom": "^5.0.1"
  • "redux": "^4.0.4"
  • "redux-firestore": "^0.8.0"
  • "redux-starter-kit": "^0.6.3"

Most helpful comment

@kanlanc If you're talking about removing redux-toolkit, I'd advise against that. If you're bothered by the dev warnings, you can use the ignoredPaths?: string[] flag in the configuration on serializableCheck when configuring getDefaultMiddleware.

@prescottprue I'd be happy to look into this (I also contribute to RTK 馃帀 ). From what I've seen, it's mostly just the timestamps needing to be converted into strings from Timestamp instances. That being said, I haven't really looked at any of the codebase outside of the types at this point.

Either way, I could open a PR with a complete configuration guide for RTK as a stop-gap until a new version is addressed regarding serializability. This is a similar pain point for other repos like: https://github.com/giantmachines/redux-websocket/issues/101

All 7 comments

Interesting thanks for reporting, I'll look into if there is a fix that won't break things.

As noted in this comment you should be able to configure the middleare to remove the serilizable check or ignore specific actions:

Disable Check

import { configureStore, getDefaultMiddleware } from 'redux-starter-kit'

export const store = configureStore({
  reducer,
  middleware: getDefaultMiddleware({
    serializableCheck: false,
  }),
})

Disable Certain Actions (Such as LOGIN)

import { configureStore, getDefaultMiddleware } from 'redux-starter-kit'
import { actionTypes } from 'react-redux-firebase'

export const store = configureStore({
  reducer,
  middleware: getDefaultMiddleware({
    serializableCheck: {
        ignoredActions: [actionTypes.LOGIN]
    }
  }),
})

Thanks for this workaround.
I just want to notice that this workaround only work with redux-starter-kit v0.7.0, the last current version released 3 days ago (which add the ability to set options to getDefaultMiddleware)

I have also this error to the following actions:

  • FILE_UPLOAD_START
  • FILE_UPLOAD_ERROR
  • FILE_UPLOAD_COMPLETE
  • FILE_DELETE_START

(and I think to all related FILE_* events from storage)

Rather than disabling serializableCheck, shouldn't we solve the serialization problem?

@sebitoelcheater Yes - open to PRs if you get a chance, but I have been too busy recently to look back into this

So, should the dev tool kit be removed for the package to work properly?

@kanlanc If you're talking about removing redux-toolkit, I'd advise against that. If you're bothered by the dev warnings, you can use the ignoredPaths?: string[] flag in the configuration on serializableCheck when configuring getDefaultMiddleware.

@prescottprue I'd be happy to look into this (I also contribute to RTK 馃帀 ). From what I've seen, it's mostly just the timestamps needing to be converted into strings from Timestamp instances. That being said, I haven't really looked at any of the codebase outside of the types at this point.

Either way, I could open a PR with a complete configuration guide for RTK as a stop-gap until a new version is addressed regarding serializability. This is a similar pain point for other repos like: https://github.com/giantmachines/redux-websocket/issues/101

Was this page helpful?
0 / 5 - 0 ratings