10000 feat(effects): remove act operator by markostanimirovic · Pull Request #4839 · ngrx/platform · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(effects): remove act operator #4839

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

Merged
merged 1 commit into from
Jun 20, 2025
Merged

Conversation

markostanimirovic
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

Closes #4837

Does this PR introduce a breaking change?

[x] Yes
[ ] No
BREAKING CHANGES:

The `act` operator is removed in favor of core RxJS flattening operators and `mapResponse` from the `@ngrx/operators` package.

BEFORE:

@Injectable()
export class AuthEffects {
  readonly login$ = createEffect(() => {
    return this.actions$.pipe(
      ofType(LoginPageActions.loginFormSubmitted),
      act({
        project: ({ credentials }) =>
          this.authService
            .login(credentials)
            .pipe(map((user) => AuthApiActions.loginSuccess({ user }))),
        error: (error) => AuthApiActions.loginFailure({ error }),
        operator: exhaustMap,
      })
    );
  });
}

AFTER:

@Injectable()
export class AuthEffects {
  readonly login$ = createEffect(() => {
    return this.actions$.pipe(
      ofType(LoginPageActions.loginFormSubmitted),
      exhaustMap(({ credentials }) =>
        this.authService.login(credentials).pipe(
          mapResponse({
            next: (user) => AuthApiActions.loginSuccess({ user }),
            error: (error) => AuthApiActions.loginFailure({ error }),
          })
        )
      )
    );
  });
}

Closes #4837

BREAKING CHANGES:

The `act` operator is removed in favor of core RxJS flattening operators and `mapResponse` from the `@ngrx/operators` package.

BEFORE:

@Injectable()
export class AuthEffects {
  readonly login$ = createEffect(() => {
    return this.actions$.pipe(
      ofType(LoginPageActions.loginFormSubmitted),
      act({
        project: ({ credentials }) =>
          this.authService
            .login(credentials)
            .pipe(map((user) => AuthApiActions.loginSuccess({ user }))),
        error: (error) => AuthApiActions.loginFailure({ error }),
        operator: exhaustMap,
      })
    );
  });
}

AFTER:

@Injectable()
export class AuthEffects {
  readonly login$ = createEffect(() => {
    return this.actions$.pipe(
      ofType(LoginPageActions.loginFormSubmitted),
      exhaustMap(({ credentials }) =>
        this.authService.login(credentials).pipe(
          mapResponse({
            next: (user) => AuthApiActions.loginSuccess({ user }),
            error: (error) => AuthApiActions.loginFailure({ error }),
          })
        )
      )
    );
  });
}
Copy link
netlify bot commented Jun 18, 2025

Deploy Preview for ngrx-io canceled.

Name Link
🔨 Latest commit 8edccef
🔍 Latest deploy log https://app.netlify.com/projects/ngrx-io/deploys/68531855f9346200082a0493

Copy link
netlify bot commented Jun 18, 2025

Deploy Preview for ngrx-site-v19 ready!

Name Link
🔨 Latest commit 8edccef
🔍 Latest deploy log https://app.netlify.com/projects/ngrx-site-v19/deploys/685318550016c700081f36d4
😎 Deploy Preview https://deploy-preview-4839--ngrx-site-v19.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@brandonroberts brandonroberts merged commit 9a83f1d into main Jun 20, 2025
14 checks passed
@brandonroberts brandonroberts deleted the feat/effects/remove-act branch June 20, 2025 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@ngrx/effects: Remove deprecated act operator
3 participants
0