Skip to content

How to close the modal from inside a command or onSelect? #752

@dariusj18

Description

@dariusj18

I want to perform an asynchronous action inside a command, but I can't figure out how to close the pallet once the action is complete.

export function AppCommandPalette () {
  const commands = [
    {
      name: 'Do Something',
      command() {
        doSomething().then(() => {
          doSomethingToCloseTheModalHere();
        });
      },
    },
  ];

  return (
      <CommandPalette commands={commands} resetInputOnOpen={true} />
  );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions