🥅(frontend) intercept 401 error on GET threads
We intercept 401 errors on GET /threads to avoid spamming Sentry with authentication errors when users are not logged in.
This commit is contained in:
@@ -11,10 +11,15 @@ and this project adheres to
|
|||||||
- ✨(helm) redirecting system #1697
|
- ✨(helm) redirecting system #1697
|
||||||
- 📱(frontend) add comments for smaller device #1737
|
- 📱(frontend) add comments for smaller device #1737
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 🥅(frontend) intercept 401 error on GET threads #1754
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- 🐛(frontend) fix tables deletion #1752
|
- 🐛(frontend) fix tables deletion #1752
|
||||||
|
|
||||||
|
|
||||||
## [4.2.0] - 2025-12-17
|
## [4.2.0] - 2025-12-17
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ export class DocsThreadStore extends ThreadStore {
|
|||||||
if (docAuth.canSee) {
|
if (docAuth.canSee) {
|
||||||
this.awareness = awareness;
|
this.awareness = awareness;
|
||||||
this.awareness?.on('update', this.onAwarenessUpdate);
|
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 we know the threadId, schedule a targeted refresh. Otherwise, fall back to full refresh.
|
||||||
if (ping.threadId) {
|
if (ping.threadId) {
|
||||||
await this.refreshThread(ping.threadId);
|
void this.refreshThread(ping.threadId);
|
||||||
} else {
|
} else {
|
||||||
await this.refreshThreads();
|
this.refreshThreads();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -280,7 +281,7 @@ export class DocsThreadStore extends ThreadStore {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
await this.refreshThreads();
|
this.refreshThreads();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,7 +299,17 @@ export class DocsThreadStore extends ThreadStore {
|
|||||||
this.notifySubscribers();
|
this.notifySubscribers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async refreshThreads(): Promise<void> {
|
public refreshThreads() {
|
||||||
|
this.initThreads().catch((e) => {
|
||||||
|
if (!(e instanceof APIError) || e.status !== 401) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public async initThreads(): Promise<void> {
|
||||||
const response = await fetchAPI(`documents/${this.docId}/threads/`, {
|
const response = await fetchAPI(`documents/${this.docId}/threads/`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
@@ -484,7 +495,7 @@ export class DocsThreadStore extends ThreadStore {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.refreshThreads();
|
this.refreshThreads();
|
||||||
this.ping(threadId);
|
this.ping(threadId);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user