How to use the @nrwl/angular.optimisticUpdate function in @nrwl/angular

To help you get started, weโ€™ve selected a few @nrwl/angular examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nrwl / ngrx-example / apps / talks / src / app / +state / talks.effects.ts View on Github external
rate$ = createEffect(() =>
    this.actions.pipe(
      ofType(TalksActions.rate),
      optimisticUpdate({
        run: a => {
          return this.backend
            .rateTalk(a.talkId, a.rating)
            .pipe(switchMap(() => of()));
        },
        undoAction: (a, e) => {
          return TalksActions.unrate({ talkId: a.talkId, error: e });
        }
      })
    )
  );

@nrwl/angular

The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: - Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. - Gen

MIT
Latest version published 2 days ago

Package Health Score

92 / 100
Full package analysis