Skip to content

Commit

Permalink
perf(CommonState): ⚡ delay(1500) => delay(0) in NgRx Effects
Browse files Browse the repository at this point in the history
  • Loading branch information
juamber-rgs committed Nov 27, 2023
1 parent be8c788 commit 2b967dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"Translations",
"Services",
"Sidebar",
"LanguageSelect"
"LanguageSelect",
"CommonState"
],
"cSpell.words": [
"cascadeselect",
Expand Down
14 changes: 7 additions & 7 deletions src/app/shared/state/common/common.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export abstract class CommonEffect<T> {
loadAll$ = createEffect(() => {
return this.actions$.pipe(
ofType(this.actions.loadAll),
delay(1500),
delay(0),
map((action: any) => action.payload),
exhaustMap((requestFilter) => {
return from(this.service.getAll(requestFilter)).pipe(
Expand All @@ -22,7 +22,7 @@ export abstract class CommonEffect<T> {
loadMore$ = createEffect(() => {
return this.actions$.pipe(
ofType(this.actions.loadMore),
delay(1500),
delay(0),
map((action: any) => action.payload),
exhaustMap((requestFilter) => {
return from(this.service.getAll(requestFilter)).pipe(
Expand All @@ -36,7 +36,7 @@ export abstract class CommonEffect<T> {
loadOne$ = createEffect(() => {
return this.actions$.pipe(
ofType(this.actions.loadOne),
delay(1500),
delay(0),
mergeMap((action: any) =>
from(this.service.getOne(action.id)).pipe(
map((item: any) => this.actions.loadOneSuccess({ payload: item })),
Expand All @@ -49,7 +49,7 @@ export abstract class CommonEffect<T> {
createOne$ = createEffect(() => {
return this.actions$.pipe(
ofType(this.actions.create),
delay(1500),
delay(0),
mergeMap((action: any) =>
from(this.service.create(action.payload)).pipe(
map((created) => this.actions.createSuccess({ payload: created })),
Expand All @@ -62,7 +62,7 @@ export abstract class CommonEffect<T> {
updateOne$ = createEffect(() => {
return this.actions$.pipe(
ofType(this.actions.update),
delay(1500),
delay(0),
mergeMap((action: any) =>
from(this.service.update(action.payload)).pipe(
map((updated) => {
Expand All @@ -79,7 +79,7 @@ export abstract class CommonEffect<T> {
deleteOne$ = createEffect(() => {
return this.actions$.pipe(
ofType(this.actions.delete),
delay(1500),
delay(0),
mergeMap((action: any) =>
from(this.service.delete(action.id)).pipe(
map(() => this.actions.deleteSuccess({ id: action.id })),
Expand All @@ -92,7 +92,7 @@ export abstract class CommonEffect<T> {
count$ = createEffect(() => {
return this.actions$.pipe(
ofType(this.actions.count),
delay(1500),
delay(0),
mergeMap(() =>
from(this.service.count()).pipe(
map((count: any) => this.actions.countSuccess({ payload: count })),
Expand Down

0 comments on commit 2b967dc

Please sign in to comment.