Skip to content
This repository was archived by the owner on Sep 1, 2024. It is now read-only.
This repository was archived by the owner on Sep 1, 2024. It is now read-only.

Failed prop type: Converting circular structure to JSON when stringifying React jsx #383

@gurkohli

Description

@gurkohli

What is the issue?

In cases when react creates jsx that references itself and that jsx is passed as a prop, an exception is thrown when that prop fails validation. The exception is because type checkers are trying to perform JSON.stringify on the prop value but it contains the circular structured jsx

React's circular structure is expected as mentioned by Dan here: facebook/react#24360 and it is up to prop-types to handle it.

Complete error:

Warning: Failed prop type: Converting circular structure to JSON
    --> starting at object with constructor 'HTMLDivElement'
    |     property '__reactFiber$dhuo6horm3g' -> object with constructor 'FiberNode'
    --- property 'stateNode' closes the circle

What is expected?

The validators when JSON.stringifying should ignore the react fields as they are not helpful to be included in the error message anyways.

prop-types circular structure error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions