Skip to content
This repository was archived by the owner on Jul 23, 2021. It is now read-only.
This repository was archived by the owner on Jul 23, 2021. It is now read-only.

"too much recursion" error when creating a Record type from an instance of another Record #127

Closed
@Methuselah96

Description

@Methuselah96

From @joepie91 on Tue, 12 Feb 2019 12:51:29 GMT

What happened

When creating a new Record type, and passing in an instance of another Record as the schema / default values, Immutable will end up in an infinite recursion loop, yielding the following error:

selection_919

I don't know whether it conceptually makes sense to try to do this (see the repro below); in my case the 'nested Record' structure was caused by a mistake during refactoring.

However, the current error is completely unclear about the cause of the issue, and provides no real way to track down the cause. I ended up spending several hours trying to find the root cause.

Expected behaviour: Either produce an understandable error with concrete guidance (if this is not supposed to be supported), or work correctly without breaking (if it is supposed to be supported).

How to reproduce

Repro:

const immutable = require("immutable");

let Foo = immutable.Record({foo: "bar"});
let fooInstance = Foo();
let Bar = immutable.Record(fooInstance);
let barInstance = Bar();

Tested in Firefox 64.0 with latest Immutable.js (4.0.0-rc.12).

Copied from original issue: immutable-js#1690

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions