Skip to content

Commit f035a85

Browse files
committed
refactor: remove .env.example and enhance error handling in chat page
- Deleted the .env.example file as it is no longer needed. - Improved error handling in the ChatPage component to handle 404 responses gracefully and log errors for failed chat prefetching.
1 parent e3a2829 commit f035a85

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

‎.env.example‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎app/chat/[id]/page.tsx‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ export default function ChatPage() {
3232
}
3333
});
3434

35+
if (response.status === 404) {
36+
// Chat doesn't exist yet, expected for new chats. Return null silently.
37+
return null;
38+
}
39+
3540
if (!response.ok) {
36-
throw new Error('Failed to load chat');
41+
console.error(`Prefetch failed for chat ${chatId}: Status ${response.status}`);
42+
return null;
3743
}
3844

3945
return response.json();

0 commit comments

Comments
 (0)