From 971f203bf011a516f531db9a2b43eaba6c91df4b Mon Sep 17 00:00:00 2001 From: Dhravya Shah Date: Thu, 12 Feb 2026 16:18:01 -0800 Subject: [PATCH 1/3] fix: chat id --- apps/web/components/new/chat/index.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/web/components/new/chat/index.tsx b/apps/web/components/new/chat/index.tsx index 657da9455..92030faf3 100644 --- a/apps/web/components/new/chat/index.tsx +++ b/apps/web/components/new/chat/index.tsx @@ -177,6 +177,13 @@ export function ChatSidebar({ transport: new DefaultChatTransport({ api: `${process.env.NEXT_PUBLIC_BACKEND_URL}/chat/v2`, credentials: "include", + body: { + metadata: { + chatId: currentChatId, + projectId: selectedProject, + model: selectedModel, + }, + }, }), onFinish: async (result) => { if (result.message.role !== "assistant") return From e22490f6de67628f806c966bb8ac509dd0b891bd Mon Sep 17 00:00:00 2001 From: Dhravya Shah Date: Thu, 12 Feb 2026 16:19:17 -0800 Subject: [PATCH 2/3] hardcode posthog key --- packages/lib/posthog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lib/posthog.tsx b/packages/lib/posthog.tsx index 438cef64b..87a28d555 100644 --- a/packages/lib/posthog.tsx +++ b/packages/lib/posthog.tsx @@ -38,7 +38,7 @@ export function PostHogProvider({ children }: { children: React.ReactNode }) { useEffect(() => { if (typeof window !== "undefined") { - const posthogKey = process.env.NEXT_PUBLIC_POSTHOG_KEY + const posthogKey = "phc_uO09ylgCPmQl3wHukVvvwhphtoIaGmCMUTTwDo3PRlt" const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL ?? "https://api.supermemory.ai" From d7a1ef7240e055419ec942618421f1805371d5dc Mon Sep 17 00:00:00 2001 From: Dhravya Shah Date: Thu, 12 Feb 2026 16:41:12 -0800 Subject: [PATCH 3/3] error boundaries --- apps/web/app/(app)/page.tsx | 36 +++++++++++++++---- apps/web/app/(app)/settings/page.tsx | 25 ++++++++++--- apps/web/components/error-boundary.tsx | 33 +++++++++++++++++ .../new/add-document/connections.tsx | 2 +- .../new/document-cards/tweet-preview.tsx | 1 + apps/web/components/new/memories-grid.tsx | 15 ++++---- 6 files changed, 94 insertions(+), 18 deletions(-) create mode 100644 apps/web/components/error-boundary.tsx diff --git a/apps/web/app/(app)/page.tsx b/apps/web/app/(app)/page.tsx index 9f2ec346a..1c112809f 100644 --- a/apps/web/app/(app)/page.tsx +++ b/apps/web/app/(app)/page.tsx @@ -29,6 +29,7 @@ import { useQuery, useQueryClient } from "@tanstack/react-query" import type { DocumentsWithMemoriesResponseSchema } from "@repo/validation/api" import type { z } from "zod" import { useViewMode } from "@/lib/view-mode-context" +import { ErrorBoundary } from "@/components/error-boundary" import { cn } from "@lib/utils" import { addDocumentParam, @@ -42,6 +43,23 @@ import { type DocumentsResponse = z.infer type DocumentWithMemories = DocumentsResponse["documents"][0] +function ViewErrorFallback() { + return ( +
+

+ Something went wrong.{" "} + +

+
+ ) +} + export default function NewPage() { const isMobile = useIsMobile() const { user, session } = useAuth() @@ -314,6 +332,7 @@ export default function NewPage() { )} >
+ }> {viewMode === "integrations" ? (
@@ -341,15 +360,18 @@ export default function NewPage() { />
)} +
- setIsChatOpen(open)} - queuedMessage={queuedChatSeed} - onConsumeQueuedMessage={() => setQueuedChatSeed(null)} - emptyStateSuggestions={highlightsData?.questions} - /> + + setIsChatOpen(open)} + queuedMessage={queuedChatSeed} + onConsumeQueuedMessage={() => setQueuedChatSeed(null)} + emptyStateSuggestions={highlightsData?.questions} + /> +
diff --git a/apps/web/app/(app)/settings/page.tsx b/apps/web/app/(app)/settings/page.tsx index 179c03012..bcea11861 100644 --- a/apps/web/app/(app)/settings/page.tsx +++ b/apps/web/app/(app)/settings/page.tsx @@ -11,6 +11,7 @@ import Account from "@/components/new/settings/account" import Integrations from "@/components/new/settings/integrations" import ConnectionsMCP from "@/components/new/settings/connections-mcp" import Support from "@/components/new/settings/support" +import { ErrorBoundary } from "@/components/error-boundary" import { useRouter } from "next/navigation" import { useIsMobile } from "@hooks/use-mobile" import { analytics } from "@/lib/analytics" @@ -248,10 +249,26 @@ export default function SettingsPage() {
- {activeTab === "account" && } - {activeTab === "integrations" && } - {activeTab === "connections" && } - {activeTab === "support" && } + + Something went wrong loading this section.{" "} + +

+ } + > + {activeTab === "account" && } + {activeTab === "integrations" && } + {activeTab === "connections" && } + {activeTab === "support" && } +
diff --git a/apps/web/components/error-boundary.tsx b/apps/web/components/error-boundary.tsx new file mode 100644 index 000000000..c9f31a4c4 --- /dev/null +++ b/apps/web/components/error-boundary.tsx @@ -0,0 +1,33 @@ +"use client" + +import { Component, type ReactNode } from "react" + +interface Props { + children: ReactNode + fallback?: ReactNode + onError?: (error: Error, errorInfo: React.ErrorInfo) => void +} + +interface State { + error: Error | null +} + +export class ErrorBoundary extends Component { + override state: State = { error: null } + + static getDerivedStateFromError(error: Error): State { + return { error } + } + + override componentDidCatch(error: Error, errorInfo: React.ErrorInfo) { + this.props.onError?.(error, errorInfo) + console.error("[ErrorBoundary]", error, errorInfo) + } + + override render() { + if (this.state.error) { + return this.props.fallback ?? null + } + return this.props.children + } +} diff --git a/apps/web/components/new/add-document/connections.tsx b/apps/web/components/new/add-document/connections.tsx index e5cb22eef..9d158f6f2 100644 --- a/apps/web/components/new/add-document/connections.tsx +++ b/apps/web/components/new/add-document/connections.tsx @@ -59,7 +59,7 @@ export function ConnectContent({ selectedProject }: ConnectContentProps) { useEffect(() => { if (!autumn.isLoading) { setIsProUser( - autumn.customer?.products.some((product) => product.id === "api_pro") ?? + autumn.customer?.products?.some((product) => product.id === "api_pro") ?? false, ) } diff --git a/apps/web/components/new/document-cards/tweet-preview.tsx b/apps/web/components/new/document-cards/tweet-preview.tsx index c9a30ecd5..d4a0f4a37 100644 --- a/apps/web/components/new/document-cards/tweet-preview.tsx +++ b/apps/web/components/new/document-cards/tweet-preview.tsx @@ -46,6 +46,7 @@ function CustomTweetHeader({ tweet: ReturnType }) { const user = tweet.user + if (!user) return null const isVerified = user.verified || user.is_blue_verified return ( diff --git a/apps/web/components/new/memories-grid.tsx b/apps/web/components/new/memories-grid.tsx index c86cd3a2a..d195d8907 100644 --- a/apps/web/components/new/memories-grid.tsx +++ b/apps/web/components/new/memories-grid.tsx @@ -10,6 +10,7 @@ import type { z } from "zod" import { Masonry, useInfiniteLoader } from "masonic" import { dmSansClassName } from "@/lib/fonts" import { SuperLoader } from "@/components/superloader" +import { ErrorBoundary } from "@/components/error-boundary" import { cn } from "@lib/utils" import { useProject } from "@/stores" import { useIsMobile } from "@hooks/use-mobile" @@ -254,12 +255,14 @@ export function MemoriesGrid({ }) => { if (data.type === "document") { return ( - + + + ) }