chore: Automatically display errors as toast if uncaught in actions (#6482)

Reduces plumbing
This commit is contained in:
Tom Moor
2024-02-05 16:40:29 -08:00
committed by GitHub
parent 3a125beb9e
commit d6595c15ad
5 changed files with 44 additions and 61 deletions

View File

@@ -107,6 +107,10 @@ export type Action = {
placeholder?: ((context: ActionContext) => string) | string;
selected?: (context: ActionContext) => boolean;
visible?: (context: ActionContext) => boolean;
/**
* Perform the action note this should generally not be called directly, use `performAction`
* instead. Errors will be caught and displayed to the user as a toast message.
*/
perform?: (context: ActionContext) => Promise<any> | any;
children?: ((context: ActionContext) => Action[]) | Action[];
};