Skip to content

using context signal: currentAbortController.signal, the error does not contain the last selected/ current selected #1723

@BananaAcid

Description

@BananaAcid

The abort error does not pass the last highlighted or selected elements along.

Problem:
Last state is unknown.

For legacy Inquirer there was some rxjs way of accessing the options? or selections? Is there something similar to work araound this issue?

import { select, checkbox } from '@inquirer/prompts';

let currentAbortController = new AbortController();
setTimeout(_ => currentAbortController.abort(), 2000);

let selection = await checkbox({
    message: 'Select something',
    choices: choices,
}, {
    signal: currentAbortController.signal,
    clearPromptOnDone: true
}).catch(e => {errorWith: error.lastSelected}) ;  // <-- this would be missing: error.lastSelected

if (selection.errorWith) {
    console.log('errored');
    selection = selection.errorWith;
}

console.log('selection', selection);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions