Skip to content

deep objects in effect state #101

@ratacat

Description

@ratacat

It seems like some unexpected behaviors can happen when using deep objects in an effect state. I have an array of nested objects in an effect definition. Once the effect is activated, it starts editing / rearranging though nested objects.

If multiple copies of the effect are created later, the state of the deep objects that are edited is copied over to the new effects. So it seems to me that the weird part is actually that the definition of the effect is being rewritten.

I ended up working around it for the moment by creating a deep copy of the original nested objected before working on them within the effect.

this.state.messageList = JSON.parse(JSON.stringify(this.state.messageListOriginal));

But thought I'd post about it to hear any thoughts from everyone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions