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

Too much recursion error for self referencing object in props #118

Closed
6 tasks done
hugoattal opened this issue Jun 5, 2022 · 1 comment · Fixed by #119
Closed
6 tasks done

Too much recursion error for self referencing object in props #118

hugoattal opened this issue Jun 5, 2022 · 1 comment · Fixed by #119
Assignees
Labels
bug Something isn't working

Comments

@hugoattal
Copy link
Collaborator

Describe the bug

When you use a self referencing object as a prop for a component, you get this error

image
image

Reproduction

Example of self referencing object:

const a = {}
const b = {}

a.child = b;
b.parent = a;

System Info

-

Used Package Manager

pnpm

Validations

@hugoattal hugoattal added the bug Something isn't working label Jun 5, 2022
@hugoattal hugoattal self-assigned this Jun 5, 2022
@Akryum
Copy link
Member

Akryum commented Jun 5, 2022

I think we can check for already visited objects quite easily with a Set:

const seen = new Set()

// ...

// Check
if (!seen.has(obj)) {
  seen.add(obj)
  // ...
}

Akryum pushed a commit that referenced this issue Jun 6, 2022
* Fix recursive object analysis

* Add seen set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants