-
-
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
feat(Schematics): Rename default action type for action blueprint #1047
Conversation
Closes #1040 BREAKING CHANGE: The action blueprint has been updated to be less generic, with associated reducer and effects updated for the feature blueprint BEFORE: export enum UserActionTypes { UserAction = '[User] Action' } export class User implements Action { readonly type = UserActionTypes.UserAction; } export type UserActions = User; AFTER: export enum UserActionTypes { LoadUsers = '[User] Load Users' } export class LoadUsers implements Action { readonly type = UserActionTypes.LoadUsers; } export type UserActions = LoadUsers;
@@ -6,7 +6,7 @@ import { Actions, Effect } from '@ngrx/effects'; | |||
export class <%= classify(name) %>Effects { | |||
<% if(feature) { %> | |||
@Effect() | |||
effect$ = this.actions$.ofType(<%= classify(name) %>ActionTypes.<%= classify(name) %>Action); | |||
effect$ = this.actions$.ofType(<%= classify(name) %>ActionTypes.Load<%= classify(name) %>s); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brandonroberts - you may want to add this:
loadEffect$ = this.actions$.ofType(<%= classify(name) %>ActionTypes.Load<%= classify(name) %>s);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
} | ||
|
||
export type <%= classify(name) %>Actions = <%= classify(name) %>; | ||
export type <%= classify(name) %>Actions = Load<%= classify(name) %>s; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brandonroberts - in the nx schematics, we generate scaffolding for both Load
and Loaded
and LoadError
. And we use union types for the Load/Loaded actions.
e.g.
export type <%= classify(name) %>Actions =
Load<%= classify(name) %>s |
<%= classify(name) %>sLoaded |
<%= classify(name) %>sLoadError;
Nx is also missing the
s
suffix... which I will add/fix.
Closes #1040
BREAKING CHANGE:
The action blueprint has been updated to be less generic, with associated reducer and effects updated for the feature blueprint
BEFORE:
export enum UserActionTypes {
UserAction = '[User] Action'
}
export class User implements Action {
readonly type = UserActionTypes.UserAction;
}
export type UserActions = User;
AFTER:
export enum UserActionTypes {
LoadUsers = '[User] Load Users'
}
export class LoadUsers implements Action {
readonly type = UserActionTypes.LoadUsers;
}
export type UserActions = LoadUsers;