We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f55dcc2 commit f008295Copy full SHA for f008295
1 file changed
client/app/bundles/server-components/components/CommentsFeed.jsx
@@ -36,7 +36,10 @@ async function CommentsFeed() {
36
try {
37
// Fetch comments directly from the Rails API — no client-side fetch needed
38
const baseUrl = resolveRailsBaseUrl();
39
- const response = await fetch(`${baseUrl}/comments.json`);
+ const controller = new AbortController();
40
+ const timeoutId = setTimeout(() => controller.abort(), 5000);
41
+ const response = await fetch(`${baseUrl}/comments.json`, { signal: controller.signal });
42
+ clearTimeout(timeoutId);
43
if (!response.ok) {
44
throw new Error(`Failed to fetch comments: ${response.status} ${response.statusText}`);
45
}
0 commit comments