Skip to content

Add response type and callback support to CommandDialog and StepperCommandDialog#53

Merged
einari merged 4 commits into
mainfrom
copilot/add-support-response-type-command-dialogs
Mar 25, 2026
Merged

Add response type and callback support to CommandDialog and StepperCommandDialog#53
einari merged 4 commits into
mainfrom
copilot/add-support-response-type-command-dialogs

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 19, 2026

Summary

@cratis/arc.react v19.11.0 introduced typed command responses and result callbacks to CommandForm. This change propagates that capability through CommandDialog and StepperCommandDialog.

Added

  • TResponse generic parameter to CommandDialog<TCommand, TResponse> and StepperCommandDialog<TCommand, TResponse> (defaults to object)
  • Five result callback props mirroring CommandResult API:
    • onSuccess(response: TResponse) - invoked on successful execution with typed response
    • onFailed(commandResult: CommandResult<TResponse>) - invoked on any failure
    • onException(messages: string[], stackTrace: string) - invoked when command throws
    • onUnauthorized() - invoked when authorization fails
    • onValidationFailure(validationResults: ValidationResult[]) - invoked on validation errors
  • Storybook stories demonstrating typed response handling and callbacks
  • Documentation sections covering response type handling and callback execution order

Changed

  • Updated @cratis/arc packages from v19.6.9 to v19.11.0

Example usage:

type CreateProjectResponse = {
    projectId: string;
    message: string;
};

<CommandDialog<CreateProject, CreateProjectResponse>
    command={CreateProject}
    title="Create Project"
    onSuccess={(response) => {
        navigate(`/projects/${response.projectId}`);
    }}
    onValidationFailure={(errors) => {
        showNotification(errors.map(r => r.message).join(', '));
    }}
/>
Original prompt

This section details on the original issue you should resolve

<issue_title>Add support for specifying the response type for CommandDialog and StepperCommandDialog</issue_title>
<issue_description>With the latest version of @cratis/arc.react there is now support for specifying the response type and it also has callbacks
for the different things that can happen with a command:

https://github.com/Cratis/Arc/releases/tag/v19.11.0

We need this to be supported transiently in CommandDialog and StepperCommandDialog.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits March 19, 2026 10:35
Co-authored-by: einari <134365+einari@users.noreply.github.com>
…nd StepperCommandDialog

Co-authored-by: einari <134365+einari@users.noreply.github.com>
Co-authored-by: einari <134365+einari@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for specifying response type in CommandDialog and StepperCommandDialog Add response type and callback support to CommandDialog and StepperCommandDialog Mar 19, 2026
Copilot AI requested a review from einari March 19, 2026 10:55
@einari einari added the minor label Mar 25, 2026
@einari einari marked this pull request as ready for review March 25, 2026 13:19
@einari einari merged commit ae9fa34 into main Mar 25, 2026
3 checks passed
@einari einari deleted the copilot/add-support-response-type-command-dialogs branch March 25, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for specifying the response type for CommandDialog and StepperCommandDialog

2 participants