-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Allow to specify action name with custom prefix in actions schematics. #3012
Comments
Being able to define a prefix seems reasonable to me. We've discussed generating actions into an existing file before, but I think its quicker to copy an existing one, than to type out a command to do the same thing. |
In context of creating only 3 actions it's might be faster to copy, but also only in specific cases. When at the beginning of creating a state you know that you will need more than 3 actions, it's faster to just prepare command and replace only actions name. What's more I think it could be nice to have a single schematic which will create action, reducer and effects by the single command and add all of them to the specified state and that might be some further step. |
@stefanoww you mean like the |
@brandonroberts Yea, I have been thinking about something similar to the feature schematics (maybe extended with possibility to generate action, reducer, effect by one command in the already generated feature). What's more currently despite generating it, you can not work on it with any other schematics from NgRx. So I would propose to create additional schematics which will allow us to generate: actions, reducers, effects for the existing files. At the beginning I would propose to start with change of the way how the feature schematics works. In my opinion it's should works much closer to the nrwl/nx schematic https://nx.dev/latest/angular/guides/misc-ngrx |
I agree with @brandonroberts here. Adding actions to an action file might be reasonable, but what's the benefit of adding new actions to reducers and effects?
@mateuszbasinski proposed a way to declare multiple actions at once (instead of the current 3 actions) in #3025. |
At the beginning I think that idea which @mateuszbasinski proposed is great. Then maybe in new PR we should respect that in the feature schematics as well. @timdeschryver |
Currently, when generating action it's always prefixed with the "load", so that when I provide action name as "DeleteUsers", I will end-up with following action within generated file "loadDeleteUsers". It will be nice to have a possibility to generate action with the custom name without "load" prefix. In my case it would be "deleteUsers", "deleteUsersSuccess" etc. What's more I think it would be great to have an option to add actions to the existing file.
If accepted, I would be willing to submit a PR for this feature
[X] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No
The text was updated successfully, but these errors were encountered: