Fix/wework sites project api - #2067
Conversation
📝 WalkthroughWalkthroughThe PR migrates Sites from legacy site records to authenticated project APIs with cursor pagination, project rename/delete operations, updated response schemas, Wework API contracts, workspace reconciliation, and improved dialog focus and submission behavior. ChangesSites project migration
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant SitesWorkspace
participant SitesApi
participant SitesGateway
participant SitesProjectAPI
User->>SitesWorkspace: search, publish, rename, or delete project
SitesWorkspace->>SitesApi: call project operation
SitesApi->>SitesGateway: send authenticated request
SitesGateway->>SitesProjectAPI: forward username, project ID, cursor, or title
SitesProjectAPI-->>SitesGateway: return project page or mutation result
SitesGateway-->>SitesApi: return validated response
SitesApi-->>SitesWorkspace: update project list and operation state
SitesWorkspace-->>User: render projects, errors, or dialog state
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
wework/src/components/common/TextInputDialog.tsx (1)
71-94: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the duplicated dialog focus trap into a shared hook. Both dialogs contain a byte-identical
handleKeyDownTab trap (focusable-element query, empty-list fallback to dialog focus, first/last wrap-around). Duplicating accessibility-critical focus logic risks the two copies silently diverging. Introduce e.g.useFocusTrap(dialogRef)returning theonKeyDownhandler and reuse it in both components.
wework/src/components/common/TextInputDialog.tsx#L71-L94: replace the inlinehandleKeyDownwith the shared hook.wework/src/components/sites/DeleteSiteDialog.tsx#L57-L80: replace the inlinehandleKeyDownwith the same shared hook.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wework/src/components/common/TextInputDialog.tsx` around lines 71 - 94, Extract the duplicated Tab focus-trap logic into a shared useFocusTrap hook that accepts dialogRef and returns the keydown handler, preserving the focusable-element query, empty-list fallback, and first/last wrap-around behavior. Replace the inline handleKeyDown implementations in wework/src/components/common/TextInputDialog.tsx lines 71-94 and wework/src/components/sites/DeleteSiteDialog.tsx lines 57-80 with the shared hook; both sites require direct changes.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@wework/src/components/common/TextInputDialog.tsx`:
- Around line 71-94: Extract the duplicated Tab focus-trap logic into a shared
useFocusTrap hook that accepts dialogRef and returns the keydown handler,
preserving the focusable-element query, empty-list fallback, and first/last
wrap-around behavior. Replace the inline handleKeyDown implementations in
wework/src/components/common/TextInputDialog.tsx lines 71-94 and
wework/src/components/sites/DeleteSiteDialog.tsx lines 57-80 with the shared
hook; both sites require direct changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9329a758-001f-4ed5-bf01-30714e1c0d52
📒 Files selected for processing (19)
.env.examplebackend/.env.examplebackend/app/api/endpoints/sites.pybackend/app/core/config.pybackend/app/schemas/site.pybackend/app/services/sites.pybackend/tests/api/test_sites_api.pydocker-compose.ymlwework/src/App.plugins.test.tsxwework/src/api/sites.test.tswework/src/api/sites.tswework/src/components/common/TextInputDialog.test.tsxwework/src/components/common/TextInputDialog.tsxwework/src/components/sites/DeleteSiteDialog.tsxwework/src/components/sites/SiteActionsMenu.tsxwework/src/components/sites/SitesWorkspace.test.tsxwework/src/components/sites/SitesWorkspace.tsxwework/src/i18n/locales/en/sites.jsonwework/src/i18n/locales/zh-CN/sites.json
Summary by CodeRabbit