Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): fix auth session not revalidating as expected (#8886)

EYHN76eabf644c26
diff --git a/packages/frontend/core/src/modules/cloud/entities/session.ts b/packages/frontend/core/src/modules/cloud/entities/session.ts
index 879105dd0e..52c0ccf580 100644
--- a/packages/frontend/core/src/modules/cloud/entities/session.ts
+++ b/packages/frontend/core/src/modules/cloud/entities/session.ts
@@ -2,13 +2,14 @@ import {
backoffRetry,
effect,
Entity,
+ exhaustMapWithTrailing,
fromPromise,
LiveData,
onComplete,
onStart,
} from '@toeverything/infra';
import { isEqual } from 'lodash-es';
-import { EMPTY, exhaustMap, mergeMap } from 'rxjs';
+import { EMPTY, mergeMap } from 'rxjs';
import { validateAndReduceImage } from '../../../utils/reduce-image';
import type { AccountProfile, AuthStore } from '../stores/auth';
@@ -66,7 +67,7 @@ export class AuthSession extends Entity {
}
revalidate = effect(
- exhaustMap(() =>
+ exhaustMapWithTrailing(() =>
fromPromise(this.getSession()).pipe(
backoffRetry({
count: Infinity,