Skip to content
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

Diff function produces no output #254

Open
jcollum-nutrien opened this issue Aug 24, 2022 · 2 comments
Open

Diff function produces no output #254

jcollum-nutrien opened this issue Aug 24, 2022 · 2 comments

Comments

@jcollum-nutrien
Copy link

Start by rendering a page, get this result, click on item 1:

image

Save as a global:

image

When I run the global function the result is undefined:

image

I have seen this function produce detailed output before. So either I'm doing something wrong or there's a bug.

@jcollum-nutrien
Copy link
Author

Talked this over with another dev and the issue is probably due to circular references in the object. If you want to fix that:

const getCircularReplacer = () => {
  const seen = new WeakSet();
  return (key, value) => {
    if (typeof value === 'object' && value !== null) {
      if (seen.has(value)) {
        return;
      }
      seen.add(value);
    }
    return value;
  };
};


JSON.stringify(obj, getCircularReplacer());

@jcollum-nutrien
Copy link
Author

Related #250

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant