How to overcome "A non-serializable value detection"

Viewed 9457

I'm implementing react app with redux-toolkit, and I get such errors when fetching data from firestore.

A non-serializable value was detected in an action, in the path: payload.0.timestamps.registeredAt

A non-serializable value was detected in an action, in the path: payload.0.profile.location.

The former's data type is firebase.firestore.Timestamp, and the latter is GeoPoint.
I think both might not be serializable, but I want to fetch those data and show them to users.
How can I overcome those errors?
According to this issue, I might write like that;

const store = configureStore({
 reducer: rootReducer,
 middleware: [
  ...getDefaultMiddleware({
  serializableCheck: {
     ignoredActionPaths: ['meta.arg', 'meta.timestamp'], // replace the left to my path
     },
  }),
  reduxWebsocketMiddleware,
 // ... your other middleware
],
});

But I'm not sure if it's safe and even if so, I don't know how to write the path dynamic way since my payload is array.


I'd really appreciate if anyone gives some clue.

2 Answers
Related