diff --git a/CHANGELOG.md b/CHANGELOG.md index 89d1ac7b..048933fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,10 +11,15 @@ and this project adheres to - ✨(helm) redirecting system #1697 - 📱(frontend) add comments for smaller device #1737 +### Changed + +- 🥅(frontend) intercept 401 error on GET threads #1754 + ### Fixed - 🐛(frontend) fix tables deletion #1752 + ## [4.2.0] - 2025-12-17 ### Added diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/comments/DocsThreadStore.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/components/comments/DocsThreadStore.tsx index 96a07d89..54b7fa4d 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/comments/DocsThreadStore.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/comments/DocsThreadStore.tsx @@ -37,7 +37,8 @@ export class DocsThreadStore extends ThreadStore { if (docAuth.canSee) { this.awareness = awareness; this.awareness?.on('update', this.onAwarenessUpdate); - void this.refreshThreads(); + + this.refreshThreads(); } } @@ -98,9 +99,9 @@ export class DocsThreadStore extends ThreadStore { // If we know the threadId, schedule a targeted refresh. Otherwise, fall back to full refresh. if (ping.threadId) { - await this.refreshThread(ping.threadId); + void this.refreshThread(ping.threadId); } else { - await this.refreshThreads(); + this.refreshThreads(); } } }; @@ -280,7 +281,7 @@ export class DocsThreadStore extends ThreadStore { }), ); - await this.refreshThreads(); + this.refreshThreads(); return; } @@ -298,7 +299,17 @@ export class DocsThreadStore extends ThreadStore { this.notifySubscribers(); } - public async refreshThreads(): Promise { + public refreshThreads() { + this.initThreads().catch((e) => { + if (!(e instanceof APIError) || e.status !== 401) { + throw e; + } + + return; + }); + } + + public async initThreads(): Promise { const response = await fetchAPI(`documents/${this.docId}/threads/`, { method: 'GET', }); @@ -484,7 +495,7 @@ export class DocsThreadStore extends ThreadStore { ); } - await this.refreshThreads(); + this.refreshThreads(); this.ping(threadId); };