Skip to content
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

add a switchTapFirst that switches to the inner observable without loosing the value. #64

Open
codemile opened this issue May 2, 2020 · 0 comments

Comments

@codemile
Copy link
Collaborator

codemile commented May 2, 2020

Overview

Often I need to do a switchMap but persist the emitted value. Maybe dispatch an action to the store, but need the observable to wait until dispatching is finished.

of("example").pipe(
    switchTapFirst(value => service.dispatch(value))
).subscribe(value => console.log(value));

The above switches to the inner observable, discards the first emitted value and then emits the original value. It acts like tapping the observable but waiting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant