Last active
March 23, 2021 09:03
-
-
Save mfp22/04554a972dab83cfca7535ef857c810d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
requireUsers$ = this.userSelectors.needUsers$.pipe( | |
filter(needUsers => needUsers), | |
tap(() => this.store.dispatch({type: 'GET_USERS'})), | |
switchMap(() => this.getUsers()), | |
tap(users => this.store.dispatch({type: 'RECEIVE_USERS', users})), | |
share(), | |
); | |
users$ = using( | |
() => this.requireUsers$.subscribe(), | |
() => this.userSelectors.users$, | |
); | |
requireUsersExtraData$ = this.users$.pipe( | |
withLatestFrom(this.userSelectors.needUsersExtraData$), | |
filter(([users, needData]) => Boolean(users.length) && needData), | |
tap(() => this.store.dispatch({type: 'GET_USERS_EXTRA_DATA'})), | |
switchMap(() => this.getUsers()), | |
tap(users => this.store.dispatch({ | |
type: 'RECEIVE_USERS_EXTRA_DATA', | |
users | |
})), | |
share(), | |
); | |
usersExtraData$ = using( | |
() => this.requireUsersExtraData$.subscribe(), | |
() => this.userSelectors.usersExtraData$, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I assume line 17 is supposed to call
this.getExtraData()
or something along those lines?