Skip to main content

Insert Object Into Array

Insert Object Into Array: appends an existing object, referenced by its id, to a shared array when Do fires.

When add (Do) fires, resolves collectionId (Array Id) to the shared array and modifyId (Object Id) to the shared object, appends the object to the end of the array, and reports one outcome: done (Done) when the object was added, or unchanged (Unchanged) when the array already held it — arrays hold each object once, so a repeat insert changes nothing. failure (Failure) fires when either id is unset. completed (Completed) fires after all three. Because arrays are shared by id, every Array node and Repeater bound to the same Array Id sees the new item immediately.

When to use it

Adding items to a local shared array — typically right after Create New Object has created the object to add. For removing use Remove Object From Array; for cloud data use the record nodes instead (nothing here is persisted).

At a glance

CategoryData
Type nameCollectionInsert
Available inbrowser, cloud
SSR compatibilitysafe
Provided bynoodl-runtime

Inputs

Values

NameTypeDefaultDescription
collectionIdString (CollectionName id)Id of the array to insert into; clearing it unbinds the node, and the next Do then fails rather than writing to a throwaway array
modifyIdStringId of the object to insert; a record with this id is created if none has been loaded yet

Signals

NameTypeDefaultDescription
addSignalAdds the object named by Object Id to the array, or fires Failure if either cannot be resolved

Outputs

Signals

NameTypeDefaultDescription
completedSignalFires after every invocation, whatever the outcome — wire this to carry on regardless. Failure still fires and still carries its reason, so this cannot hide an error
doneSignalFires once the object has been added to the array
unchangedSignalFires when the object was already in the array, so nothing was added

Failure outputs

NameTypeDefaultDescription
errorStringWhy the last attempt changed nothing, in one sentence; empty until something fails
failureSignalFires when the array or the object could not be resolved, so nothing was changed

Patterns

  • Create New Object createdadd and idmodifyId: the canonical create-then-insert flow.

Watch out for

  • Trying to insert a raw value or JS object — modifyId takes an object id, not the data itself; create an object first with Create New Object.

Examples

Named shared array with insert, remove and clear

A client-side list without a backend: an Array node (Collection2) binds to the named shared array 'todos' and feeds a Repeater. Add Item (CollectionInsert), Remove Item (CollectionRemove) and Clear (CollectionClear) mutate the same array by its collectionId; every node bound to that id — including the Array feeding the list — sees the change immediately. Ids on wires tie the writers to the store.

Array, Remove Object From Array, Clear Array, Create New Array, Create New Object, Object

Generated

This page is generated from node-catalog-enriched.json. Do not edit it by hand — run npm run docs:nodes to regenerate, and fix the source enrichment instead.