fix(core): fetch share docs on non-cloud workspace (#7144)

This commit is contained in:
EYHN
2024-06-04 09:45:35 +00:00
parent db0837936a
commit f67108c6f7
6 changed files with 30 additions and 10 deletions
@@ -36,12 +36,12 @@ export class ShareDocsList extends Entity {
revalidate = effect(
switchMap(() =>
fromPromise(signal =>
this.store.getWorkspacesShareDocs(
fromPromise(signal => {
return this.store.getWorkspacesShareDocs(
this.workspaceService.workspace.id,
signal
)
).pipe(
);
}).pipe(
backoffRetry({
when: isNetworkError,
count: Infinity,
@@ -21,7 +21,7 @@ import { ShareDocsStore } from './stores/share-docs';
export function configureShareDocsModule(framework: Framework) {
framework
.scope(WorkspaceScope)
.service(ShareDocsService)
.service(ShareDocsService, [WorkspaceService])
.store(ShareDocsStore, [GraphQLService])
.entity(ShareDocsList, [
WorkspaceService,
@@ -1,7 +1,16 @@
import { WorkspaceFlavour } from '@affine/env/workspace';
import type { WorkspaceService } from '@toeverything/infra';
import { Service } from '@toeverything/infra';
import { ShareDocsList } from '../entities/share-docs-list';
export class ShareDocsService extends Service {
shareDocs = this.framework.createEntity(ShareDocsList);
constructor(private readonly workspaceService: WorkspaceService) {
super();
}
shareDocs =
this.workspaceService.workspace.flavour === WorkspaceFlavour.AFFINE_CLOUD
? this.framework.createEntity(ShareDocsList)
: null;
}