Skip to content

Commit c62a9e7

Browse files
Fix: minified react error on inspect routing (#191)
<!-- CURSOR_SUMMARY --> > [!NOTE] > Refactors the sandbox inspect route to a client-driven view, adds client directives across inspect/UI modules, switches to motion/react, and makes JsonPopover button customizable. > > - **Inspect**: > - **Client View Extraction**: Replaces page-level composition with `SandboxInspectView` that wraps `SandboxInspectProvider`, `Filesystem`, and `Viewer`. > - **Client Components**: Adds `'use client'` to `dir.tsx`, `file.tsx`, `node.tsx`, `parent-dir-item.tsx`, and the new `view.tsx`. > - **Motion**: Switches imports to `motion/react` in `frame.tsx` and `stopped-banner.tsx`. > - **Header/UI**: > - **JsonPopover**: Converted to client component and supports `buttonProps` to customize trigger; `metadata.tsx` updated to use it instead of a direct `Button`. > - **Metrics**: > - **Dependency Fix**: Includes `lastMetrics` in `total` `useMemo` deps in `resource-usage-client.tsx`. > - **Clients**: > - Marks Supabase browser client (`src/lib/clients/supabase/client.ts`) as a client module. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit b126ae2. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 3c4dfe7 commit c62a9e7

File tree

13 files changed

+74
-38
lines changed

13 files changed

+74
-38
lines changed

next.config.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ const config = {
88
experimental: {
99
useCache: true,
1010
turbopackFileSystemCacheForDev: true,
11-
clientSegmentCache: true,
1211
serverActions: {
1312
bodySizeLimit: '5mb',
1413
},
1514
authInterrupts: true,
15+
clientSegmentCache: true,
1616
},
1717
logging: {
1818
fetches: {
@@ -31,17 +31,17 @@ const config = {
3131
value: 'SAMEORIGIN',
3232
},
3333
],
34-
},
34+
},
3535
],
3636
rewrites: async () => ({
3737
beforeFiles: [
3838
{
39-
source: "/ph-proxy/static/:path*",
40-
destination: "https://us-assets.i.posthog.com/static/:path*",
39+
source: '/ph-proxy/static/:path*',
40+
destination: 'https://us-assets.i.posthog.com/static/:path*',
4141
},
4242
{
43-
source: "/ph-proxy/:path*",
44-
destination: "https://us.i.posthog.com/:path*",
43+
source: '/ph-proxy/:path*',
44+
destination: 'https://us.i.posthog.com/:path*',
4545
},
4646

4747
// Asset rewrites for Mintlify
@@ -51,7 +51,7 @@ const config = {
5151
},
5252
{
5353
source: '/_mintlify/:path*',
54-
destination: `https://${DOCUMENTATION_DOMAIN}/_mintlify/:path*`,
54+
destination: `https://${DOCUMENTATION_DOMAIN}/_mintlify/:path*`,
5555
},
5656
],
5757
}),
Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { COOKIE_KEYS } from '@/configs/cookies'
2-
import { SandboxInspectProvider } from '@/features/dashboard/sandbox/inspect/context'
3-
import SandboxInspectFilesystem from '@/features/dashboard/sandbox/inspect/filesystem'
4-
import SandboxInspectViewer from '@/features/dashboard/sandbox/inspect/viewer'
5-
import { cn } from '@/lib/utils'
2+
import SandboxInspectView from '@/features/dashboard/sandbox/inspect/view'
63
import { getSandboxRoot } from '@/server/sandboxes/get-sandbox-root'
7-
import ClientOnly from '@/ui/client-only'
84
import { cookies } from 'next/headers'
95

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

3026
return (
31-
<SandboxInspectProvider
27+
<SandboxInspectView
3228
rootPath={rootPath}
3329
seedEntries={res?.data?.entries ?? []}
34-
>
35-
<ClientOnly
36-
className={cn(
37-
'flex flex-1 gap-4 overflow-hidden p-3 md:p-6',
38-
'max-md:sticky max-md:top-0 max-md:min-h-[calc(100vh-var(--protected-navbar-height))]'
39-
)}
40-
>
41-
<SandboxInspectFilesystem rootPath={rootPath} />
42-
<SandboxInspectViewer />
43-
</ClientOnly>
44-
</SandboxInspectProvider>
30+
/>
4531
)
4632
}

src/features/dashboard/sandbox/header/metadata.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

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

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

2019
return (
21-
<JsonPopover json={sandboxInfo.metadata}>
22-
<Button
23-
variant="accent"
24-
size="sm"
25-
className="h-5 font-sans prose-label-highlight"
26-
>
27-
<Braces className="size-3.5" />
28-
Metadata
29-
</Button>
20+
<JsonPopover
21+
json={sandboxInfo.metadata}
22+
buttonProps={{
23+
variant: 'accent',
24+
size: 'sm',
25+
className: 'h-5 font-sans prose-label-highlight',
26+
}}
27+
>
28+
<Braces className="size-3.5" />
29+
Metadata
3030
</JsonPopover>
3131
)
3232
}

src/features/dashboard/sandbox/header/resource-usage-client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const ResourceUsageClient = memo(
2929
return sandboxInfo?.memoryMB
3030
}
3131
return lastMetrics?.diskTotalGb
32-
}, [props.type, sandboxInfo])
32+
}, [props.type, sandboxInfo, lastMetrics])
3333

3434
return (
3535
<ResourceUsage

src/features/dashboard/sandbox/inspect/dir.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client'
2+
13
import { cn } from '@/lib/utils'
24
import { DataTableRow } from '@/ui/data-table'
35
import { AlertCircle, FolderClosed, FolderOpen } from 'lucide-react'

src/features/dashboard/sandbox/inspect/file.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client'
2+
13
import { cn } from '@/lib/utils'
24
import { DataTableRow } from '@/ui/data-table'
35
import { AlertCircle, FileIcon } from 'lucide-react'

src/features/dashboard/sandbox/inspect/frame.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client'
22

33
import { cn } from '@/lib/utils'
4-
import { motion } from 'framer-motion'
4+
import { motion } from 'motion/react'
55
import React from 'react'
66

77
type SandboxInspectFrameProps = React.ComponentProps<typeof motion.div> & {

src/features/dashboard/sandbox/inspect/node.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client'
2+
13
import SandboxInspectDir from './dir'
24
import SandboxInspectFile from './file'
35
import { useFilesystemNode } from './hooks/use-node'

src/features/dashboard/sandbox/inspect/parent-dir-item.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client'
2+
13
import { cn } from '@/lib/utils'
24
import { DataTableRow } from '@/ui/data-table'
35
import { FolderUp } from 'lucide-react'

src/features/dashboard/sandbox/inspect/stopped-banner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
CardTitle,
88
cardVariants,
99
} from '@/ui/primitives/card'
10-
import { AnimatePresence, motion } from 'framer-motion'
10+
import { AnimatePresence, motion } from 'motion/react'
1111
import { AlertTriangle } from 'lucide-react'
1212
import { useMemo } from 'react'
1313
import { useSandboxContext } from '../context'

0 commit comments

Comments
 (0)