Skip to content

Immutable.fromJS: Detect cycles (RangeError: Maximum call stack size exceeded) #653

Closed
@gasi

Description

@gasi

When trying to convert circular data structures using Immutable.fromJS, it currently throws RangeError: Maximum call stack size exceeded. Instead of this, could fromJS follow the semantics of JSON.stringify and throw a more meaningful error, similar to TypeError: Converting circular structure to JSON?

Pardon if this is a duplicate, but I searched the existing issues for this and couldn’t find it.

Please let me know if you need any more details and thanks for building Immutable.js 😄

Repro: https://jsbin.com/kupavixuhe/edit?js,console

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