Skip to content

Commit 480a5cc

Browse files
author
Gerome El-assaad
committed
updated sandbox errors
1 parent 804f86c commit 480a5cc

10 files changed

Lines changed: 41 additions & 30 deletions

File tree

app/api/chat/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export async function POST(req: Request) {
7272
schema,
7373
system: toPrompt(template),
7474
messages,
75-
maxRetries: 0, // do not retry on errors
75+
maxRetries: 2,
7676
...modelParams,
7777
})
7878

@@ -121,4 +121,4 @@ export async function POST(req: Request) {
121121
},
122122
)
123123
}
124-
}
124+
}

app/api/sandbox/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,4 @@ export async function POST(req: Request) {
153153
{ status: 500, headers: { 'Content-Type': 'application/json' } }
154154
)
155155
}
156-
}
156+
}

app/layout.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import { Analytics } from "@vercel/analytics/next"
88
import { SpeedInsights } from "@vercel/speed-insights/next"
99
import Script from 'next/script'
1010
import r from 'react-syntax-highlighter/dist/esm/languages/hljs/r'
11-
import { telemetryService } from '@/lib/telemetry-service'
12-
import React from 'react'
1311

1412
export const metadata: Metadata = {
1513
metadataBase: new URL('https://codingit.vercel.app'),
@@ -46,10 +44,6 @@ export default function RootLayout({
4644
}: Readonly<{
4745
children: React.ReactNode
4846
}>) {
49-
React.useEffect(() => {
50-
telemetryService.track('app_load', {})
51-
}, [])
52-
5347
return (
5448
<html
5549
lang="en"
@@ -97,4 +91,4 @@ export default function RootLayout({
9791
</body>
9892
</html>
9993
)
100-
}
94+
}

app/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,15 @@ export default function Home() {
5656
const [isAuthDialogOpen, setAuthDialog] = useState(false)
5757
const [authView, setAuthView] = useState<ViewType>('sign_in')
5858
const [isRateLimited, setIsRateLimited] = useState(false)
59+
const setAuthDialogCallback = useCallback(setAuthDialog, [])
60+
const setAuthViewCallback = useCallback(setAuthView, [])
5961
const [errorMessage, setErrorMessage] = useState('')
6062
const [executionResult, setExecutionResult] = useState<ExecutionResult | undefined>(undefined)
6163

6264
const [currentProject, setCurrentProject] = useState<Project | null>(null)
6365
const [isLoadingProject, setIsLoadingProject] = useState(false)
6466

65-
const { session, userTeam } = useAuth(setAuthDialog, setAuthView)
67+
const { session, userTeam } = useAuth(setAuthDialogCallback, setAuthViewCallback)
6668

6769

6870
const { executeCode: enhancedExecuteCode } = useEnhancedChat({

components/telemetry-provider.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use client'
2+
3+
import { telemetryService } from '@/lib/telemetry-service'
4+
import React from 'react'
5+
6+
export function TelemetryProvider({ children }: { children: React.ReactNode }) {
7+
React.useEffect(() => {
8+
telemetryService.track('app_load', {})
9+
}, [])
10+
11+
return <>{children}</>
12+
}

lib/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export function useAuth(
100100
})
101101

102102
return () => subscription.unsubscribe()
103-
}, [recovery, setAuthDialog, setAuthView, posthog])
103+
}, [recovery, posthog])
104104

105105
return {
106106
session,

lib/supabase-credentials.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!
2+
export const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
3+
export const supabaseServiceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY!

lib/supabase-server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { createServerClient as _createServerClient } from '@supabase/ssr'
22
import { cookies } from 'next/headers'
3+
import { supabaseUrl, supabaseAnonKey, supabaseServiceRoleKey } from './supabase-credentials'
34

45
export function createServerClient(useServiceRole = false) {
56
const cookieStore = cookies()
6-
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!
77
const supabaseKey = useServiceRole
8-
? process.env.SUPABASE_SERVICE_ROLE_KEY!
9-
: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
8+
? supabaseServiceRoleKey
9+
: supabaseAnonKey
1010

1111
return _createServerClient(supabaseUrl, supabaseKey, {
1212
cookies: {

package-lock.json

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"@swc/core": "^1.12.11",
9090
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
9191
"@types/next": "^8.0.7",
92-
"@types/node": "^22.16.3",
92+
"@types/node": "^22.18.0",
9393
"@types/node-fetch": "^2.6.12",
9494
"@types/prismjs": "^1.26.4",
9595
"@types/react": "^18",

0 commit comments

Comments
 (0)