Copy Array
This node creates a deep copy of an array, generating new IDs for all items.
The Copy Array node duplicates a collection so it can be modified independently.
The Copy Array node takes a source array and creates a completely new array containing copies of the original items. Crucially, it generates new Object IDs for every item. This means modifying the copied items will not affect the original items.
Inputs
General
| Data | Description |
|---|---|
| Source Items | The array to copy. |
Actions
| Signal | Description |
|---|---|
| Do | Triggers the copy operation. |
Outputs
General
| Data | Description |
|---|---|
| Copied Items | The new array with copied items. |
| Copy Id | The ID of the new array. |
| Original Id | The ID of the source array. |
| Count | Number of items in the copy. |
Events
| Signal | Description |
|---|---|
| Done | Triggered when the copy is complete. |
Usage
Use this when you need to edit a list without changing the master version, such as "Edit Order" or "Duplicate Project".
Example Use Cases
- Editing a Record:
- User selects an item from a master list.
- Copy Array (or Copy Object if available) to create a draft.
- User edits the draft.
- On "Save", you overwrite the original; on "Cancel", you discard the draft.
- Templates:
- Have a "Template Project" (Static Array).
- When user creates a new project, Copy Array from the template to give them their own independent version.
Detailed Behavior
- Deep Copy: Properties of the objects are copied.
- New IDs: Every object gets a fresh UUID. This breaks the link to the original data model.
- Reactivity: The node listens to changes on the new collection, updating outputs if the copy changes.
Troubleshooting
- Changes affecting original: If this happens, you likely didn't use Copy Array, or you are copying an array that contains references to other objects (nested objects might not be deep-copied depending on depth). This node performs a shallow copy of the object properties, but assigns new IDs.