You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the ng g feature path/to/feature/state/<state-name> -a -c --module path/to/feature is great to scaffold whole state features in the consistent fashion across many features / projects.
The issue is that when used, the generated reducer is "vanilla" eg not implementing entity pattern.
It would be great to introduce additional -e or --entity flag which would
generate reducer with all the boilerplate for entity pattern in place
generate .model.ts with stub interface (same as for ng g entity)
adjust generated on(...) handlers to already use adapter as it can be expected that genrated load (and success) action will lead to ...adapter.setAll(<entity name>, state) implementation in loadSuccess handler.
Describe any alternatives/workarounds you're currently using
The entity pattern needs to be added manually into the generated reducer (or the entity reducer generated over the previously generated state feature)
Other information:
Would be great as the ng g feature ... already is doing soo much good in terms of consistency of projects!
If accepted, I would be willing to submit a PR for this feature
[ ] Yes (Assistance is provided if you need help submitting a pull request)
[ x] No (sorry, extremely busy lately 😅)
The text was updated successfully, but these errors were encountered:
Before I open a PR, I have one question - should this functionality support an entity with a name that's different from the feature name? Or just create an entity with the feature name, and let the user run ng g entity afterwards? I could see something like "I want a feature ToDoList with one entity named ToDo and another entity named Category"
wgd3
pushed a commit
to wgd3/platform
that referenced
this issue
Apr 17, 2023
BEFORE:
Entity schematic had to be run after generating a new feature:
```sh
ng generate feature User
ng generate entity User -m app.module.ts -r user.reducer.ts
```
AFTER:
Feature schematic allows for creation of an entity:
```sh
ng generate feature User --entity
```
closesngrx#3260
Currently the
ng g feature path/to/feature/state/<state-name> -a -c --module path/to/feature
is great to scaffold whole state features in the consistent fashion across many features / projects.The issue is that when used, the generated reducer is "vanilla" eg not implementing entity pattern.
It would be great to introduce additional
-e
or--entity
flag which wouldng g entity
)on(...)
handlers to already use adapter as it can be expected that genrated load (and success) action will lead to...adapter.setAll(<entity name>, state)
implementation in loadSuccess handler.Describe any alternatives/workarounds you're currently using
The entity pattern needs to be added manually into the generated reducer (or the entity reducer generated over the previously generated state feature)
Other information:
Would be great as the
ng g feature ...
already is doing soo much good in terms of consistency of projects!If accepted, I would be willing to submit a PR for this feature
[ ] Yes (Assistance is provided if you need help submitting a pull request)
[ x] No (sorry, extremely busy lately 😅)
The text was updated successfully, but these errors were encountered: