-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Origin contains CIRCULAR attributes in state #45
Comments
@p0o I could also find Solution 1: Use Redux DevTools Extension instead of Redux DevTools. This extension resolves the issue you're facing. Solution 2: Wrap redux-devtools-extension/src/app/api/index.js function tryCatchStringify(obj) {
try {
return JSON.stringify(obj);
} catch (err) {
/* eslint-disable no-console */
if (process.env.NODE_ENV !== 'production') console.log('Failed to stringify', err);
/* eslint-enable no-console */
return jsan.stringify(obj, null, null, { circular: '[CIRCULAR]' });
}
} |
Vanilla Redux DevTools uses However, you might want to get your data with circular references back when persisting the state. In this case you should add |
@zalmoxisus Thanks for helping! Redux DevTools Extension v3 looks smart. @p0o I assumed you just want to see the state by using |
Thank you both for answers. Right now I'm not persisting the tooltip part of my state so there shouldn't be a problem. The thing is I am not sure if this approach is correct and does storing circular data in state creates any performance problems or not? If you think it's common and we wouldn't have deeply nested circular references that makes the serialization slow, I would stick to the custom |
I guess storing a reference to the React component will not allow to persist the data (I'm referring not only to the Redux DevTools, but also for cases when persisting the state in localStorage or on the server side). Even if there are no circular data the reference will be lost. However, usually we don't need to persist a tooltip. If so, you could easily remove the component data for |
@zalmoxisus this |
@p0o I didn't look into the sources, but I guess those actions and states come from |
To clarify, |
Awesome @zalmoxisus that would solve my problem 100%. Mentioning that, @kuy I think it would be a good idea to add this method to actions and reducers of |
I didn't know overwriting @p0o Yeah, I'd like to add |
I had this weird circular error when I setup a basic implementation of this lib on my codebase:
Basically circular structure means an object which is containing elements that refer to the same object and these type of objects are not serializable. So after using an Origin for any element I had this error because somewhere in my react setup I had a serialization like this:
In my case it leads to crashing redux dev tools and redux dev tools also show the circulation inside
state.tooltip[NAME].Origin._hostnode
key as below:Any ideas?
The text was updated successfully, but these errors were encountered: