Skip to content
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/warden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
- uses: actions/checkout@v4
- uses: getsentry/warden@v0
with:
anthropic-api-key: ${{ secrets.WARDEN_ANTHROPIC_API_KEY }}
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
12 changes: 0 additions & 12 deletions warden.toml
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@
version = 1

[defaults.filters]
ignorePaths = ["docs/**", "**/*.md", "**/*.lock", "**/*.json"]

[[triggers]]
name = "security-review"
event = "pull_request"
actions = ["opened", "synchronize", "reopened"]
skill = "security-review"
remote = "getsentry/skills"

[triggers.filters]
paths = ["src/**", "web/**", "mobile/**"]

[[triggers]]
name = "react-best-practices"
event = "pull_request"
actions = ["opened", "synchronize", "reopened"]
skill = "vercel-react-best-practices"
remote = "vercel-labs/agent-skills"

[triggers.filters]
paths = ["**/*.tsx", "**/*.jsx"]

[[triggers]]
name = "code-simplifier"
event = "pull_request"
actions = ["opened", "synchronize", "reopened"]
skill = "code-simplifier"
remote = "getsentry/skills"

[triggers.filters]
paths = ["src/**", "web/**", "mobile/**"]
39 changes: 27 additions & 12 deletions web/src/pages/WorkspaceList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { useState, useEffect } from 'react'
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { useNavigate } from 'react-router-dom'
import { Plus, RefreshCw, Boxes, ChevronRight, Sparkles, Monitor, AlertTriangle, Shield, Network } from 'lucide-react'
import { api, type WorkspaceInfo, type CreateWorkspaceRequest, type HostInfo } from '@/lib/api'
Expand Down Expand Up @@ -179,15 +179,30 @@ export function WorkspaceList() {
const newNameError = trimmedNewName ? getUserWorkspaceNameError(trimmedNewName) : null
const canCreate = trimmedNewName.length > 0 && !newNameError

const { data: workspaces, isLoading, error, refetch } = useQuery({
queryKey: ['workspaces'],
queryFn: api.listWorkspaces,
})
// BAD: useEffect + sequential awaits instead of parallel useQuery
const [workspaces, setWorkspaces] = useState<WorkspaceInfo[] | null>(null)
const [hostInfo, setHostInfo] = useState<HostInfo | null>(null)
const [isLoading, setIsLoading] = useState(true)
const [error, setError] = useState<Error | null>(null)

const { data: hostInfo } = useQuery({
queryKey: ['hostInfo'],
queryFn: api.getHostInfo,
})
useEffect(() => {
async function loadData() {
try {
// BAD: waterfall - these could run in parallel
const ws = await api.listWorkspaces()
setWorkspaces(ws)
const host = await api.getHostInfo()
setHostInfo(host)
} catch (e) {
setError(e as Error)
} finally {
setIsLoading(false)
}
}
loadData()
}, [])

const refetch = () => window.location.reload()

This comment was marked as outdated.


const createMutation = useMutation({
mutationFn: (data: CreateWorkspaceRequest) => api.createWorkspace(data),
Expand Down Expand Up @@ -348,9 +363,9 @@ export function WorkspaceList() {
</h2>
</div>
<div className="rounded-lg border bg-card/50 overflow-hidden">
{workspaces?.map((ws: WorkspaceInfo) => (
{workspaces?.map((ws: WorkspaceInfo, i: number) => (
<WorkspaceRow
key={ws.name}
key={i}
workspace={ws}
onClick={() => handleRowClick(ws)}
/>
Expand Down
Loading