Object cloning across workflow blocks

I have noticed a behavior recently while create a multistep function in a workflow. It seemed like I was getting a different behavior depending on if I ran the function using test data triggering the steps one by one or if I triggered the function block, inputting the same test data.

What I noticed when triggering the block one by one was, If a block passed an object along to the next block and that second block performed mutating type operations on the objects properties, a third block could still reference the data from the first block and see the properties as they were before the changes in the second block.

But, when running the function as a block from the main workflow, this apparent cloning of the data from block to block didn’t seem to be happening. The third block in the function would end up seeing the object from the first block as it had been mutated from the second block.

I found this curious and was wondering if this is intended behavior? For some reason I though each block was supposed to contain cloned data that was completely isolated from upstream blocks and could not mutate the data in those upstream blocks.

Hi @Shawn_Crocker,

Thanks for reaching out about this

Workflow blocks have access to their parent blocks as variables, but the data used is different based on how it is run.

  1. Running from the frontend (run button on a block, run with previous blocks)
  2. Running the whole workflow in the backend (run button on the top right of the workflow editor)

When running from the frontend, it uses the data built up in the browser so far (data that is seen in the block outputs). When running from the backend, it uses data built up in memory while running all the blocks.

You might see a similar discrepancy in what data is used when referencing current_user and running a block in the frontend versus running the whole workflow