Skip to content

Mutating the output of step.do #24117

@Mael-Abgrall

Description

@Mael-Abgrall

Existing documentation URL(s)

What changes are you suggesting?

On the workflow documentation, there is a mention that we should not rely on the state outside of a step; however, there is no mention about mutating the state.

Would the state be reset to the first instance, or kept in memory?

Additional information

let myOutput = await step.do('something', async () => {
  return Number(1);
});
while (myOutput < 10) {
  await step.sleep("💤💤💤💤", "3 hours");
  myOutput = await step.do('something', async () => {
    return myOutput + 1;
  });
}

In this example, would myOutput be 1 or 10?

Metadata

Metadata

Assignees

Labels

content:editRequest for content editsdocumentationDocumentation editsproduct:workflowsWorkflows: https://developers.cloudflare.com/workflows/

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions