rt2zz / redux-persist

persist and rehydrate a redux store
MIT License
12.95k stars 865 forks source link

redux-persist/createPersistoid: error serializing state TypeError: Converting circular structure to JSON #1317

Open Progressive-Programmer opened 3 years ago

Progressive-Programmer commented 3 years ago

Trying to save socket.io instance in reducer this error message pops continuously

This is how we are dispatching the socket instance

      const socket = io(baseURL, { auth: { token } });
      dispatch(socketConnectAction(socket))
index.js:1 redux-persist/createPersistoid: error serializing state TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Socket'
    |     property 'io' -> object with constructor 'Manager'
    |     property 'nsps' -> object with constructor 'Object'
    --- property '/' closes the circle
    at JSON.stringify (<anonymous>)
    at defaultSerialize (createPersistoid.js:126)
    at processNextKey (createPersistoid.js:71)
graceydev commented 6 months ago

Any update on this?

yuanfa0620 commented 2 months ago

redux-persist/createPersistoid: error serializing state TypeError: Converting circular structure to JSON --> starting at object with constructor 'EventEmitter' | property '_events' -> object with constructor 'Events' | property 'change' -> object with constructor 'EE' --- property 'context' closes the circle

yuanfa0620 commented 2 months ago

redux-persist/createPersistoid: error serializing state TypeError: Converting circular structure to JSON --> starting at object with constructor 'EventEmitter' | property '_events' -> object with constructor 'Events' | property 'change' -> object with constructor 'EE' --- property 'context' closes the circle