Skip to content

Clone element work only after serialize and deserialize #209

Open
@nicosh

Description

@nicosh

Describe the bug
A little bit of context, in #144 the first solution for cloning elements causes linked cloned nodes to change props to the original ones, #144 (comment) seems to have the same problem, but actually the nodes ids are changed and if we deserialize a serialized state editor inside a setTimeout function it works.
To Reproduce
Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/epic-colden-giwsw
  2. Select a button, on the settings panel under delete click clone
  3. Try to changes some props to the cloned element
  4. You can see that props are changed to the original one.
  5. Now uncomment line 87 on settings panel https://codesandbox.io/s/epic-colden-giwsw?file=/components/SettingsPanel.js:2258-2268
  6. Now the clone function works

Expected behavior
Cloning an element and run actions.addNodeTree should load the correct data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions