Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: CommandHooks should be able to create additional commands #5469

Open
1 task done
mficzel opened this issue Feb 15, 2025 · 0 comments · May be fixed by #5468
Open
1 task done

FEATURE: CommandHooks should be able to create additional commands #5469

mficzel opened this issue Feb 15, 2025 · 0 comments · May be fixed by #5468

Comments

@mficzel
Copy link
Member

mficzel commented Feb 15, 2025

Is there an existing issue for this topic?

  • I have searched the existing issues

Description

CommandHooks are the way to process and modify incoming commands. However since they always return a single command a CommandHook cannot add additional commands to the chain.

Possible use cases:

  • A CreateNodeVariant command is processed and the node properties are translated. This would require adding an additional SetNodeProperties Command
  • A SetNodeProperties command is performed and a second SetNodeProperties command is created that translates the modified properties to other dimensions.

Possible Solution

A possible solution would be an onAfterHandle(): void method in the commandHookInterface. This method can be used to raise additional commands.

Alternatively the onBeforeHandle method could allow returning CommandInterface | Commands but that would come with quite some complexity as currently the results of each hook are passed to the next one.

@mficzel mficzel linked a pull request Feb 15, 2025 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant