-
-
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): add success/failure effects/actions to ng generate feature #1530
feat(Schematics): add success/failure effects/actions to ng generate feature #1530
Conversation
I'm updating the unit tests on this schematic to match the new code |
Preview docs changes for 99bc13b at https://previews.ngrx.io/pr1530-99bc13b/ |
Preview docs changes for 674056f at https://previews.ngrx.io/pr1530-674056f/ |
Looks like the bazel build step failed but it was a timeout issue: #!/bin/bash -eo pipefail
yarn
yarn install v1.10.1
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
Too long with no output (exceeded 10m0s) |
We'll investigate if it keeps timing out. Some initial feedback:
|
Preview docs changes for 674056f at https://previews.ngrx.io/pr1530-674056f/ |
That all sounds good to me. Just one question regarding tests.... How should I handle a current test that is going to fail now because the |
Preview docs changes for 4615abf at https://previews.ngrx.io/pr1530-4615abf/ |
Preview docs changes for 7cb5bb2 at https://previews.ngrx.io/pr1530-7cb5bb2/ |
@brandonroberts regarding tests, nevermind, I get what you're saying, I will create new tests that test the schematics with the new flag enabled. The current tests will be reverted to match exactly as before as they are testing with the flag disabled by default. Sorry for the confusion. |
Preview docs changes for 9012cc3 at https://previews.ngrx.io/pr1530-9012cc3/ |
…f api flag enabled
@brandonroberts latest commit includes...
|
Preview docs changes for 1a7bf87 at https://previews.ngrx.io/pr1530-1a7bf87/ |
modules/schematics/src/action/files/__name@dasherize@if-flat__/__name@dasherize__.actions.ts
Outdated
Show resolved
Hide resolved
modules/schematics/src/effect/files/__name@dasherize@if-flat__/__name@dasherize__.effects.ts
Outdated
Show resolved
Hide resolved
modules/schematics/src/effect/files/__name@dasherize@if-flat__/__name@dasherize__.effects.ts
Outdated
Show resolved
Hide resolved
modules/schematics/src/effect/files/__name@dasherize@if-flat__/__name@dasherize__.effects.ts
Outdated
Show resolved
Hide resolved
modules/schematics/src/reducer/files/__name@dasherize@if-flat__/__name@dasherize__.reducer.ts
Show resolved
Hide resolved
modules/schematics/src/effect/files/__name@dasherize@if-flat__/__name@dasherize__.effects.ts
Outdated
Show resolved
Hide resolved
modules/schematics/src/effect/files/__name@dasherize@if-flat__/__name@dasherize__.effects.ts
Outdated
Show resolved
Hide resolved
Preview docs changes for 006a2bc at https://previews.ngrx.io/pr1530-006a2bc/ |
Preview docs changes for 8c059cb at https://previews.ngrx.io/pr1530-8c059cb/ |
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.
LGTM 👍
load<%= classify(name) %>s$ = this.actions$.pipe( | ||
ofType(<%= classify(name) %>ActionTypes.Load<%= classify(name) %>s), | ||
concatMap(() => | ||
EMPTY.pipe( |
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.
I feel like we need some comment here to tell the user to replace the empty observable?
EMPTY.pipe( | |
/** An EMPTY observable only emits completion. Replace with your own observable API request */ | |
EMPTY.pipe( |
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.
That makes sense to me.
Preview docs changes for 8091938 at https://previews.ngrx.io/pr1530-8091938/ |
LGTM. Docs for https://ngrx.io/guide/schematics/feature can be done separately. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Closes #1529
Should resolve #1524
What is the new behavior?
The PR enhances the default effect generated for feature.
LoadFeatureSuccess
andLoadFeatureFailure
LoadFeature
action sets loading to trueLoadFeatureSuccess
action sets loading to false, nulls error property and updates data with payload.LoadFeatureFailure
action sets loading to false, populates error from payloadloadFeatureEffect$
to demonstrate the idea of a request action, and then based on the return of an observable dispatch a success or failure action.Does this PR introduce a breaking change?
Other information