Skip to content

Prompt value should only be mutated on finalise #330

Closed
@43081j

Description

@43081j

Currently, we have some freaky behaviours in that value is repurposed through the lifetime of a prompt.

Let's take autocomplete multi for example. It goes like this:

  • value is empty
  • user types in foo
  • value is now "foo"
  • user selects the "foo" option with <TAB>
  • user presses <RETURN>
  • value is now [ 'foo' ]

so the type is basically string | undefined | string[]

this is pretty confusing and means functions which deal with value (like validate) have no clue what type the value will be

could be a string, an array, an object, whatever. its basically unknown

i think we should mutate some internal value which represents user input (when they type something in), and mutate value for the prompt's strongly typed value

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions