Skip to content

Where do you store the current value in workflows that are editors? #328

@zoltish

Description

@zoltish

Hej!

First of all, Im sorry for the out of place question; its more related to state machines, but given that workflows are such machines I still think this might be the best spot for it. I hope Im not wrong!

How do you deal with workflows that are editors?

If we go with a simple example like editing a number, its clear that the editor workflow renders something that allows editing the value, but where should the current value actually be stored? I think there are 2 alternatives?

  1. When the editor workflow is initially rendered, the value is stored in its state as the current one, any edits to the value are stored in its state. When the editor is done, the value is emitted to the parent workflow and then cleared locally.

  2. The input/props include the value, and every change emits an output with the new value, which the parent stores in its state.

How do you deal with this? Are there other alternatives? Ive personally leaned towards 2, but that includes more work for the parent workflow and reusability becomes more of a chore. Please enlighten me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions