Scripting Block feature request: prompt for input in parallel

The Scripting Block offers a number of asynchronous functions for collecting input from the user. To date, all the example scripts I’ve seen use these APIs one at a time in a sequential fashion, e.g.

const name = await input.textAsync('What is your name?');
const birthplace = await input.textAsync('Where were you born?');

This pattern is serviceable, but it produces an unideal user experience: users are led on a forced march through one question at a time. That can be disorienting when folks run a script for the first time, and that’s particularly apparent when more input is required.

Given that the APIs all return Promises, I expected to be able to compose them in parallel and prompt the user for all input simultaneously, e.g.

const [name, birthplace] = await Promise.all([
  input.textAsync('What is your name?'),
  input.textAsync('Where were you born?')

That would show users the full extent of the required input “up-front” and offer them the freedom to provide it in a sequence of their choosing.

In the Scripting Block today, the second code example does not function as intended.

  • the UI is initially rendered according to the use case (both input fields are present)

  • entering data into either field causes a “spinner” animation to be appended to the document (somewhat confusing, but not entirely disruptive)

  • entering data into the second field causes an error to be displayed, e.g.

    R: userInputStartTime
        at main on line 30
1 Like

Scripting block was inspired by the idea of a command line interface, where users enter one command at a time and wait for the result before continuing on.

If you don’t want users to deal with the forced march, I suggest that you write a custom block instead.

1 Like

Thanks for the background on the design process. If this is an intentional constraint, then a Promise may not be an appropriate abstraction.