refactor(core): adjust effect api (#11935)
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
Service,
|
||||
smartRetry,
|
||||
} from '@toeverything/infra';
|
||||
import { EMPTY, mergeMap, switchMap, timer } from 'rxjs';
|
||||
import { switchMap, tap, timer } from 'rxjs';
|
||||
|
||||
import { AccountChanged, type AuthService } from '../../cloud';
|
||||
import { ServerStarted } from '../../cloud/events/server-started';
|
||||
@@ -45,9 +45,8 @@ export class NotificationCountService extends Service {
|
||||
}
|
||||
return this.store.getNotificationCount(signal);
|
||||
}).pipe(
|
||||
mergeMap(result => {
|
||||
tap(result => {
|
||||
this.setCount(result ?? 0);
|
||||
return EMPTY;
|
||||
}),
|
||||
smartRetry(),
|
||||
catchErrorInto(this.error$),
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
Service,
|
||||
smartRetry,
|
||||
} from '@toeverything/infra';
|
||||
import { EMPTY, exhaustMap, mergeMap } from 'rxjs';
|
||||
import { EMPTY, exhaustMap, tap } from 'rxjs';
|
||||
|
||||
import type { Notification, NotificationStore } from '../stores/notification';
|
||||
import type { NotificationCountService } from './count';
|
||||
@@ -43,10 +43,10 @@ export class NotificationListService extends Service {
|
||||
signal
|
||||
)
|
||||
).pipe(
|
||||
mergeMap(result => {
|
||||
tap(result => {
|
||||
if (!result) {
|
||||
// If the user is not logged in, we just ignore the result.
|
||||
return EMPTY;
|
||||
return;
|
||||
}
|
||||
const { edges, pageInfo, totalCount } = result;
|
||||
this.notifications$.next([
|
||||
@@ -59,8 +59,6 @@ export class NotificationListService extends Service {
|
||||
|
||||
this.hasMore$.next(pageInfo.hasNextPage);
|
||||
this.nextCursor$.next(pageInfo.endCursor ?? undefined);
|
||||
|
||||
return EMPTY;
|
||||
}),
|
||||
smartRetry(),
|
||||
catchErrorInto(this.error$),
|
||||
|
||||
Reference in New Issue
Block a user