Hey,I encounter a problem like this:
redux-persist:cannot process cyclical state.
Consider changing your state structure to have no cycles.
Alternatively blacklist the corresponding reducer key.
Cycle encounted at key "context" with value "[object Object]"
And my state structure is:
{
"activeConversation": "223sssse234234",
"client": IMClient, // object
"convById": Map() // Map, store the conversation object
"msgById": Map() // Map, store the message object
convListSortedByUpdatedTimeList(), // store the message ids
}
so how can I resolve the problem? I need your help,thank you!
Your state tree needs to be serializeable. That's basically the whole idea behind redux, that you can easily swap out the state tree because it is serializable. In your case it seems like you have a function inside your store.
There is a great discussion about what to put into redux's state tree here: https://github.com/reactjs/redux/issues/1385
Agree with @marvinhagemeister
Also to elaborate on the error, it means json-stringify-safe failed to serialize the state. I would check out convListSortedByUpdatedTimeList() and IMClient to make sure these do not have any circuclar data.
if you want to serialize cyclic state (and somehow have a parser that know how to do that) you can implement it via a custom transform (createTransform)
I was storing my react-navigation current navigation state in the redux store and that was somehow causing a cycle. Changed it to only store the current route name
I've been having basically the same issue, I'm having the log that follows:
redux-persist: cannot process cyclical state.
Consider changing your state structure to have no cycles.
Alternatively blacklist the corresponding reducer key.
Cycle encounted at key "0" with value "5978ab989c24c60015f1a81c".
Where 0 is the first position of an array and 5978ab989c24c60015f1a81c is a id from my mongodb. This is being stored like this:
"data": {
...,
"wallets": [
{
"label": String,
"operational_settings": {
"automatic_balance": Boolean
},
"user_id": userId,
"accounts": [
"5978ab989c24c60015f1a81c"
],
"created_at": ISODate
}
]
}
Any idea of what I may be doing wrong?
any thing new with this issue @leticiacostadias
Most helpful comment
I've been having basically the same issue, I'm having the log that follows:
Where
0is the first position of an array and5978ab989c24c60015f1a81cis a id from my mongodb. This is being stored like this:Any idea of what I may be doing wrong?