Skip to content

Conversation

@sweetmantech
Copy link
Collaborator

@sweetmantech sweetmantech commented Feb 2, 2026

Merge test branch changes to main

Summary by CodeRabbit

  • New Features
    • Added visual sandbox cards displaying ID, colored status indicator, and creation timestamp in the sandbox history list.
    • Integrated loading indicator while fetching sandbox data.
    • Implemented error handling with retry functionality for failed sandbox retrieval.
    • Sandbox list now automatically refreshes after successful sandbox creation.

* feat: show sandbox history on /sandboxes page

- Add getSandboxes lib function to fetch sandbox history from API
- Add useSandboxes hook with React Query for data fetching
- Update SandboxesPage to display history with loading/error states
- Update SandboxList with status colors and creation timestamps

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor: simplify sandbox components with SRP and refetch

- Extract SandboxListCard.tsx component (SRP)
- Replace handleSandboxCreated with refetch in SandboxesPage
- Update SandboxCreateSection to use onSuccess callback
- Remove local state management in favor of React Query refetch

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
@sweetmantech sweetmantech merged commit d75f53b into main Feb 2, 2026
1 of 3 checks passed
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 2, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The changes refactor sandbox management by extracting data fetching into a custom hook (useSandboxes), introducing a new API endpoint (getSandboxes), simplifying the creation callback to a generic onSuccess pattern, adding a presentational component (SandboxListCard), and implementing loading and error UI states.

Changes

Cohort / File(s) Summary
API Layer
lib/sandboxes/getSandboxes.ts
New public function that fetches sandboxes from the external API using Bearer authentication, includes error handling for failed requests.
Custom Hook
hooks/useSandboxes.ts
New React hook that wraps getSandboxes with React Query, manages authentication via Privy, and exposes sandboxes, isLoading, error, and refetch.
Sandbox Creation
components/Sandboxes/SandboxCreateSection.tsx
Changed public API: onSandboxCreated callback signature replaced with onSuccess() void callback; creation logic simplified to call createSandbox and trigger success callback without handling returned data.
Sandbox List UI
components/Sandboxes/SandboxList.tsx, components/Sandboxes/SandboxListCard.tsx
Extracted new SandboxListCard presentational component for rendering individual sandbox cards; refactored SandboxList to use the card component and display "Sandbox History" heading; added empty state messaging.
Page Integration
components/Sandboxes/SandboxesPage.tsx
Replaced local state management with useSandboxes hook; added loading indicator and error UI with retry button; connected SandboxCreateSection's onSuccess to hook's refetch method for automatic list refresh.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SandboxesPage
    participant useSandboxes Hook
    participant SandboxCreateSection
    participant API Server
    
    User->>SandboxesPage: Visit page
    SandboxesPage->>useSandboxes Hook: Call hook
    useSandboxes Hook->>API Server: GET /api/sandboxes (with token)
    API Server-->>useSandboxes Hook: Return sandboxes[]
    useSandboxes Hook-->>SandboxesPage: Return data + refetch
    SandboxesPage->>SandboxesPage: Show SandboxList
    
    User->>SandboxCreateSection: Click create sandbox
    SandboxCreateSection->>API Server: POST create sandbox
    API Server-->>SandboxCreateSection: Success
    SandboxCreateSection->>useSandboxes Hook: Call onSuccess()
    useSandboxes Hook->>API Server: refetch: GET /api/sandboxes
    API Server-->>useSandboxes Hook: Return updated sandboxes[]
    useSandboxes Hook-->>SandboxesPage: New sandboxes
    SandboxesPage->>SandboxesPage: Update SandboxList display
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Fix/org workspace link #1466: Both PRs integrate with the new external API surface by utilizing NEW_API_BASE_URL; this PR adds the getSandboxes endpoint call while the related PR manages the API configuration and resource proxying.

Poem

🏗️ From nested state to hooks so clean,
Sandboxes fetch in serene machine,
Refetch on success, errors caught with care,
Cards now isolated, light as air! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant