Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ const config = {
experimental: {
useCache: true,
turbopackFileSystemCacheForDev: true,
clientSegmentCache: true,
serverActions: {
bodySizeLimit: '5mb',
},
authInterrupts: true,
clientSegmentCache: true,
},
logging: {
fetches: {
Expand All @@ -31,17 +31,17 @@ const config = {
value: 'SAMEORIGIN',
},
],
},
},
],
rewrites: async () => ({
beforeFiles: [
{
source: "/ph-proxy/static/:path*",
destination: "https://us-assets.i.posthog.com/static/:path*",
source: '/ph-proxy/static/:path*',
destination: 'https://us-assets.i.posthog.com/static/:path*',
},
{
source: "/ph-proxy/:path*",
destination: "https://us.i.posthog.com/:path*",
source: '/ph-proxy/:path*',
destination: 'https://us.i.posthog.com/:path*',
},

// Asset rewrites for Mintlify
Expand All @@ -51,7 +51,7 @@ const config = {
},
{
source: '/_mintlify/:path*',
destination: `https://${DOCUMENTATION_DOMAIN}/_mintlify/:path*`,
destination: `https://${DOCUMENTATION_DOMAIN}/_mintlify/:path*`,
},
],
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { COOKIE_KEYS } from '@/configs/cookies'
import { SandboxInspectProvider } from '@/features/dashboard/sandbox/inspect/context'
import SandboxInspectFilesystem from '@/features/dashboard/sandbox/inspect/filesystem'
import SandboxInspectViewer from '@/features/dashboard/sandbox/inspect/viewer'
import { cn } from '@/lib/utils'
import SandboxInspectView from '@/features/dashboard/sandbox/inspect/view'
import { getSandboxRoot } from '@/server/sandboxes/get-sandbox-root'
import ClientOnly from '@/ui/client-only'
import { cookies } from 'next/headers'

const DEFAULT_ROOT_PATH = '/home/user'
Expand All @@ -28,19 +24,9 @@ export default async function SandboxInspectPage({
})

return (
<SandboxInspectProvider
<SandboxInspectView
rootPath={rootPath}
seedEntries={res?.data?.entries ?? []}
>
<ClientOnly
className={cn(
'flex flex-1 gap-4 overflow-hidden p-3 md:p-6',
'max-md:sticky max-md:top-0 max-md:min-h-[calc(100vh-var(--protected-navbar-height))]'
)}
>
<SandboxInspectFilesystem rootPath={rootPath} />
<SandboxInspectViewer />
</ClientOnly>
</SandboxInspectProvider>
/>
)
}
20 changes: 10 additions & 10 deletions src/features/dashboard/sandbox/header/metadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import { JsonPopover } from '@/ui/json-popover'
import { Badge } from '@/ui/primitives/badge'
import { Button } from '@/ui/primitives/button'
import { Braces, CircleSlash } from 'lucide-react'
import { useSandboxContext } from '../context'

Expand All @@ -18,15 +17,16 @@ export default function Metadata() {
}

return (
<JsonPopover json={sandboxInfo.metadata}>
<Button
variant="accent"
size="sm"
className="h-5 font-sans prose-label-highlight"
>
<Braces className="size-3.5" />
Metadata
</Button>
<JsonPopover
json={sandboxInfo.metadata}
buttonProps={{
variant: 'accent',
size: 'sm',
className: 'h-5 font-sans prose-label-highlight',
}}
>
<Braces className="size-3.5" />
Metadata
</JsonPopover>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const ResourceUsageClient = memo(
return sandboxInfo?.memoryMB
}
return lastMetrics?.diskTotalGb
}, [props.type, sandboxInfo])
}, [props.type, sandboxInfo, lastMetrics])

return (
<ResourceUsage
Expand Down
2 changes: 2 additions & 0 deletions src/features/dashboard/sandbox/inspect/dir.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { cn } from '@/lib/utils'
import { DataTableRow } from '@/ui/data-table'
import { AlertCircle, FolderClosed, FolderOpen } from 'lucide-react'
Expand Down
2 changes: 2 additions & 0 deletions src/features/dashboard/sandbox/inspect/file.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { cn } from '@/lib/utils'
import { DataTableRow } from '@/ui/data-table'
import { AlertCircle, FileIcon } from 'lucide-react'
Expand Down
2 changes: 1 addition & 1 deletion src/features/dashboard/sandbox/inspect/frame.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

import { cn } from '@/lib/utils'
import { motion } from 'framer-motion'
import { motion } from 'motion/react'
import React from 'react'

type SandboxInspectFrameProps = React.ComponentProps<typeof motion.div> & {
Expand Down
2 changes: 2 additions & 0 deletions src/features/dashboard/sandbox/inspect/node.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import SandboxInspectDir from './dir'
import SandboxInspectFile from './file'
import { useFilesystemNode } from './hooks/use-node'
Expand Down
2 changes: 2 additions & 0 deletions src/features/dashboard/sandbox/inspect/parent-dir-item.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { cn } from '@/lib/utils'
import { DataTableRow } from '@/ui/data-table'
import { FolderUp } from 'lucide-react'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
CardTitle,
cardVariants,
} from '@/ui/primitives/card'
import { AnimatePresence, motion } from 'framer-motion'
import { AnimatePresence, motion } from 'motion/react'
import { AlertTriangle } from 'lucide-react'
import { useMemo } from 'react'
import { useSandboxContext } from '../context'
Expand Down
31 changes: 31 additions & 0 deletions src/features/dashboard/sandbox/inspect/view.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'use client'

import { SandboxInspectProvider } from '@/features/dashboard/sandbox/inspect/context'
import SandboxInspectFilesystem from '@/features/dashboard/sandbox/inspect/filesystem'
import SandboxInspectViewer from '@/features/dashboard/sandbox/inspect/viewer'
import { cn } from '@/lib/utils'
import type { EntryInfo } from 'e2b'

interface SandboxInspectViewProps {
rootPath: string
seedEntries: EntryInfo[]
}

export default function SandboxInspectView({
rootPath,
seedEntries,
}: SandboxInspectViewProps) {
return (
<SandboxInspectProvider rootPath={rootPath} seedEntries={seedEntries}>
<div
className={cn(
'flex flex-1 gap-4 overflow-hidden p-3 md:p-6',
'max-md:sticky max-md:top-0 max-md:min-h-[calc(100vh-var(--protected-navbar-height))]'
)}
>
<SandboxInspectFilesystem rootPath={rootPath} />
<SandboxInspectViewer />
</div>
</SandboxInspectProvider>
)
}
2 changes: 2 additions & 0 deletions src/lib/clients/supabase/client.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { Database } from '@/types/database.types'
import { createBrowserClient } from '@supabase/ssr'

Expand Down
11 changes: 10 additions & 1 deletion src/ui/json-popover.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { useShikiTheme } from '@/configs/shiki'
import { cn } from '@/lib/utils'
import {
Expand All @@ -13,10 +15,16 @@ import { ScrollArea, ScrollBar } from './primitives/scroll-area'
interface JsonPopoverProps {
json: unknown
children: React.ReactNode
buttonProps?: React.ComponentPropsWithoutRef<typeof Button>
className?: string
}

export function JsonPopover({ json, children, className }: JsonPopoverProps) {
export function JsonPopover({
json,
children,
buttonProps,
className,
}: JsonPopoverProps) {
const [isOpen, setIsOpen] = useState(false)

const shikiTheme = useShikiTheme()
Expand All @@ -41,6 +49,7 @@ export function JsonPopover({ json, children, className }: JsonPopoverProps) {
e.preventDefault()
setIsOpen(true)
}}
{...buttonProps}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Event handlers in buttonProps override critical popover handlers

The {...buttonProps} spread at line 52 occurs after hardcoded onClick and onDoubleClick handlers (lines 42-50). If buttonProps contains these event properties, they will silently override the essential handlers that call stopPropagation(), preventDefault(), and set isOpen(true). This breaks the popover's functionality. The handlers should be merged or buttonProps should be placed before the hardcoded handlers to allow them to take precedence.

Fix in Cursor Fix in Web

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected

>
{children}
</Button>
Expand Down
Loading