-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
Accepting PRsGood First IssueGood issue for first-time contributorGood issue for first-time contributorProject: Schematics
Description
This happens when we create a new Store for feature with the feature schematic.
The generation command:
ng generate feature dashboard/store/Dashboard -m dashboard/dashboard.module.ts --group
with the following settings:
? Should we generate and wire success and failure actions? Yes
? Do you want to use the create functions? Yes
? What should be the prefix of the action? custom
This generates actions.ts with "custom prefix". But effects and reducers.ts still use the default "load" prefix. Related to (#3012)
Minimal reproduction of the bug/regression with instructions:
- Repo with minimal reproduction: https://github.com/hemangsk/ngrx-feature-schematics-bug
- Commands for reproduction
ng add @ngrx/schematics@latest
ng g m dashboard --routing
ng g c dashboard/dashboard
ng add @ngrx/store@latest
ng generate feature dashboard/store/Dashboard -m dashboard/dashboard.module.ts --group
Expected behavior:
- effects.ts and reducers.ts should use the supplied prefix.
Versions of NgRx, Angular, Node, affected browser(s) and operating system(s):
- "@ngrx/store": "^12.4.0"
- "@angular/core": "~11.1.0"
- "@angular/cli": "~11.1.0"
- "@angular/compiler-cli": "~11.1.0"
- "@ngrx/schematics": "^12.4.0"
- node v14.15.2
- Google Chrome Version 92.0.4515.131 (Official Build) (x86_64)
Other information:
I would be glad to submit a patch.
Possible solution:
- https://github.com/ngrx/platform/blob/master/modules/schematics/src/effect/index.ts#L108 modified as
function getEffectStart(name: string, creators?: boolean, prefix?: string): string {
const effectName = stringUtils.classify(name);
return creators
? `{prefix}${effectName}s$ = createEffect(() => {` +
'\n return this.actions$.pipe( \n'
: '@Effect()\n' + ` load${effectName}s$ = this.actions$.pipe(`;
}
I would be willing to submit a PR to fix this issue
[x ] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No
Metadata
Metadata
Assignees
Labels
Accepting PRsGood First IssueGood issue for first-time contributorGood issue for first-time contributorProject: Schematics