Skip to content

refactor(wework): extract cloud project context - #2510

Merged
qdaxb merged 3 commits into
mainfrom
refactor/wework-cloud-project-context
Aug 9, 2026
Merged

refactor(wework): extract cloud project context#2510
qdaxb merged 3 commits into
mainfrom
refactor/wework-cloud-project-context

Conversation

@qdaxb

@qdaxb qdaxb commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Extracted cloud project/task binding, project-space auto-join, cloud mention candidates, and delivery state from DesktopWorkbenchMain into useWorkbenchCloudProjectContext.
  • Reduced DesktopWorkbenchMain.tsx by roughly 600 lines and moved the cloud workflow behind an explicit hook interface.
  • Split project-space loading from default-project selection so choosing the default space no longer triggers a duplicate project-list request.
  • Added focused tests for pending runtime context, default project auto-selection, and cloud-to-local delivery mapping.

Why

DesktopWorkbenchMain is one of the highest-churn Wework files and was coordinating more than 100 hooks. The cloud project workflow was an independent asynchronous state machine embedded in the main layout, which increased the blast radius of unrelated workbench changes and made its request behavior difficult to test directly.

Impact

  • No intended user-facing behavior change.
  • Future changes to project-space binding and delivery context can be made and tested without modifying the main desktop layout.
  • Default project-space initialization performs one project-list request instead of reloading after it selects the default project.

Validation

  • pnpm --filter wework typecheck
  • ESLint and Prettier checks for all changed files
  • pnpm --filter wework exec vitest run src/components/layout/useWorkbenchCloudProjectContext.test.tsx
  • pnpm --filter wework exec vitest run src/components/layout/DesktopWorkbenchLayout.test.tsx — 166 passed
  • pnpm --filter wework test — 333 files, 3198 tests passed
  • Full pre-push quality gate — ESLint, TypeScript, and unit tests passed
  • Isolated real-Tauri verification — workbench initialized, empty task composer rendered, and the composer plugin picker opened and closed successfully

Summary by CodeRabbit

  • New Features

    • Added centralized cloud project and task management in the workbench.
    • Added automatic selection of the configured default project space.
    • Added cloud task delivery, project/task navigation, mention loading, and todo binding support.
  • Bug Fixes

    • Improved handling of pending project and task associations.
    • Added safeguards for asynchronous loading and binding failures.
  • Tests

    • Added coverage for project selection, pending task preparation, and cloud-to-local task conversion.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@qdaxb, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 21 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8aca2ac2-d1f9-4a13-9cfd-c761eec04d94

📥 Commits

Reviewing files that changed from the base of the PR and between 86d7e11 and a1991e0.

📒 Files selected for processing (3)
  • wework/src/components/layout/DesktopWorkbenchMain.tsx
  • wework/src/components/layout/useWorkbenchCloudProjectContext.test.tsx
  • wework/src/components/layout/useWorkbenchCloudProjectContext.ts
📝 Walkthrough

Walkthrough

The change extracts cloud project, task, delivery, mention, binding, and navigation logic from DesktopWorkbenchMain into useWorkbenchCloudProjectContext. The hook prepares submission context, manages asynchronous cloud data, and exposes centralized UI handlers. Tests cover default project selection, pending bindings, and task conversion.

Changes

Workbench cloud context refactor

Layer / File(s) Summary
Context contracts and task conversion
wework/src/components/layout/useWorkbenchCloudProjectContext.ts
The hook adds cloud context types, binding helpers, status labels, local work-item conversion, and runtime submission context generation.
Context loading and binding
wework/src/components/layout/useWorkbenchCloudProjectContext.ts
The hook loads projects, tasks, deliveries, files, and mention candidates. It protects asynchronous updates, selects default projects, and binds pending projects or tasks to runtime tasks.
Project navigation and submission actions
wework/src/components/layout/useWorkbenchCloudProjectContext.ts
The hook handles project selection, task navigation, delivery completion, submission preparation, todo-manager flows, picker state, and completed bindings.
Desktop pane integration and validation
wework/src/components/layout/DesktopWorkbenchMain.tsx, wework/src/components/layout/useWorkbenchCloudProjectContext.test.tsx
DesktopWorkbenchMain delegates cloud behavior and UI actions to the hook, removes duplicated state, updates callback dependencies, and adds hook tests.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DesktopWorkbenchMain
  participant useWorkbenchCloudProjectContext
  participant CloudProjectApi
  participant WorkspaceNavigation
  DesktopWorkbenchMain->>useWorkbenchCloudProjectContext: prepareSubmission
  useWorkbenchCloudProjectContext->>CloudProjectApi: resolve pending project or task binding
  CloudProjectApi-->>useWorkbenchCloudProjectContext: return project and task context
  useWorkbenchCloudProjectContext-->>DesktopWorkbenchMain: return submission context
  DesktopWorkbenchMain->>useWorkbenchCloudProjectContext: openDelivery
  useWorkbenchCloudProjectContext->>WorkspaceNavigation: navigate to todo view
Loading

Possibly related PRs

  • wecode-ai/Wegent#2409: Introduced the cloud project, task binding, delivery, mention, and navigation logic extracted by this PR.
  • wecode-ai/Wegent#2427: Added related cloud project binding, delivery, runtime-task association, and context behavior.
  • wecode-ai/Wegent#1989: Introduced TODO workspace flows supported by the centralized workbench context.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: extracting cloud project context into a dedicated hook.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/wework-cloud-project-context

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.

@qdaxb
qdaxb marked this pull request as ready for review August 9, 2026 03:05

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (9)
wework/src/components/layout/useWorkbenchCloudProjectContext.ts (5)

246-246: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Reuse the memoized todoBindingApis instead of recomputing projectSpaceApis(services).

Line 170 already memoizes projectSpaceApis(services). Lines 246, 439, and 652 call the same helper again with the same input. Reusing the memo removes the duplication and keeps one source of the API list.

As per coding guidelines: "Before adding code, search for and reuse existing components, services, utilities, and patterns; extract shared logic instead of duplicating it."

Also applies to: 439-439

🤖 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/layout/useWorkbenchCloudProjectContext.ts` at line 246,
Update the API assignments at the referenced call sites in the workbench context
to reuse the memoized `todoBindingApis` value created earlier, removing repeated
`projectSpaceApis(services)` calls while preserving the existing API-list
behavior.

Source: Coding guidelines


411-419: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Route the delivery mention labels through t.

Lines 414 and 416 build the candidate title and the reference chip from a hardcoded Chinese string. Every other label in this effect uses t with a Chinese default. Add translation keys so the delivery candidates follow the same i18n path.

🌐 Proposed fix
             ...deliveries.items.map(delivery =>
               candidate(
                 `cloud-delivery:${delivery.id}`,
-                `交付 ${delivery.id.slice(0, 8)}`,
+                `${t('workbench.mention_cloud_delivery_chip', '交付')} ${delivery.id.slice(0, 8)}`,
                 delivery.delivered_at ?? delivery.created_at,
-                `[$交付 ${delivery.id.slice(0, 8)}](cloud://projects/${projectId}/deliveries/${delivery.id})`,
+                `[$${t('workbench.mention_cloud_delivery_chip', '交付')} ${delivery.id.slice(0, 8)}](cloud://projects/${projectId}/deliveries/${delivery.id})`,
                 ['交付', 'delivery', delivery.id]
               )
             ),
🤖 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/layout/useWorkbenchCloudProjectContext.ts` around lines
411 - 419, Update the delivery candidate mapping in the surrounding effect to
pass both the candidate title and reference-chip label through the existing t
function, using Chinese defaults and distinct translation keys for each label.
Preserve the delivery ID interpolation and cloud URL unchanged.

643-645: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Simplify the submissionItem condition.

submissionProject is null whenever currentRuntimeTask is set, so Line 645 compares undefined with pendingCloudProject?.id. When currentRuntimeTask is null, the comparison is always true. The expression reduces to a single check on currentRuntimeTask.

♻️ Proposed fix
       const submissionProject = currentRuntimeTask ? null : pendingCloudProject
-      const submissionItem =
-        submissionProject?.id === pendingCloudProject?.id ? pendingTodoItem : null
+      const submissionItem = submissionProject ? pendingTodoItem : null
🤖 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/layout/useWorkbenchCloudProjectContext.ts` around lines
643 - 645, In the submission setup, simplify the `submissionItem` assignment to
depend only on whether `currentRuntimeTask` is absent, since `submissionProject`
is derived from that same condition. Preserve `pendingTodoItem` when no runtime
task exists and return `null` otherwise; update the expression near
`submissionProject` without changing surrounding behavior.

448-469: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the unreachable catch after Promise.allSettled.

Promise.allSettled never rejects. The handler at Lines 467-469 cannot run. Individual failures are already dropped by the result.status === 'fulfilled' filter at Line 457.

As per coding guidelines: "Delete dead code and do not add compatibility shims or fallback paths without agreement; correct the primary path."

♻️ Proposed fix
-    void Promise.allSettled(
+    void Promise.allSettled(
       apis.map(async api => {
         const result = await api.listCloudProjects()
         return result.items
       })
-    )
-      .then(results => {
-        if (!active) return
-        const candidates = results.flatMap(result =>
-          result.status === 'fulfilled' ? result.value : []
-        )
-        const uniqueProjects = candidates.filter(
-          (candidate, index) =>
-            candidates.findIndex(
-              other => other.id === candidate.id && other.project_store === candidate.project_store
-            ) === index
-        )
-        setCloudProjects(uniqueProjects)
-      })
-      .catch(() => {
-        if (active) setCloudProjects([])
-      })
+    ).then(results => {
+      if (!active) return
+      const candidates = results.flatMap(result =>
+        result.status === 'fulfilled' ? result.value : []
+      )
+      const uniqueProjects = candidates.filter(
+        (candidate, index) =>
+          candidates.findIndex(
+            other => other.id === candidate.id && other.project_store === candidate.project_store
+          ) === index
+      )
+      setCloudProjects(uniqueProjects)
+    })
🤖 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/layout/useWorkbenchCloudProjectContext.ts` around lines
448 - 469, Remove the unreachable catch handler from the Promise.allSettled
chain in the cloud-project loading flow, preserving the existing
fulfilled-result filtering and active-state guard in the then callback.

Source: Coding guidelines


159-167: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Consider splitting the hook along the layers it already contains.

useWorkbenchCloudProjectContext spans about 600 lines and mixes four concerns: bound-context loading, pending binding, mention candidate loading, and UI action handlers. The extraction from DesktopWorkbenchMain is a clear improvement. A follow-up split into smaller hooks, for example useCloudMentionCandidates and useCloudProjectBinding, would keep each unit focused.

As per coding guidelines: "Comments must be in English, names must be clear, and functions should remain focused, preferably under 50 lines" and "Favor cohesive modules, explicit interfaces, and standard practices".

🤖 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/layout/useWorkbenchCloudProjectContext.ts` around lines
159 - 167, Split useWorkbenchCloudProjectContext into focused hooks aligned with
its existing responsibilities: extract cloud project binding/bound-context
loading and mention candidate loading into cohesive hooks such as
useCloudProjectBinding and useCloudMentionCandidates, while keeping UI action
handlers separate. Preserve the current public context API and behavior, and use
clear English names and explicit interfaces for the extracted hooks.

Source: Coding guidelines

wework/src/components/layout/useWorkbenchCloudProjectContext.test.tsx (3)

106-120: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert that the delivery-scoped list APIs are not called during default-project selection.

The PR states that project-space loading no longer triggers duplicate project-list requests. Line 120 checks listCloudProjects once, which covers half of that claim. Add assertions for listCloudFiles and listLoopItems call counts so a future regression that re-fetches per project space fails this test.

💚 Proposed addition
     expect(deliveryApi.listCloudProjects).toHaveBeenCalledOnce()
+    expect(deliveryApi.listCloudFiles).toHaveBeenCalledOnce()
+    expect(deliveryApi.listLoopItems).toHaveBeenCalledOnce()

Adjust the expected counts to the intended behavior after the pending project is selected.

🤖 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/layout/useWorkbenchCloudProjectContext.test.tsx` around
lines 106 - 120, Extend the default-project selection test around
useWorkbenchCloudProjectContext to assert the delivery-scoped list APIs
listCloudFiles and listLoopItems are each called exactly once, alongside the
existing listCloudProjects assertion, preserving the intended
no-duplicate-request behavior.

68-89: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for onRuntimeTaskCreated.

The test verifies cloudProjectId and additionalContext. It does not exercise the onRuntimeTaskCreated callback returned by prepareSubmission, which records the runtime target on pendingTodoBinding and drives the binding effect. That callback is the mechanism that connects a pending cloud project to a newly created runtime task. Adding a case that invokes it and then re-renders with a currentRuntimeTask would cover the main binding path.

🤖 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/layout/useWorkbenchCloudProjectContext.test.tsx` around
lines 68 - 89, Add coverage in the pending-project test around prepareSubmission
and its onRuntimeTaskCreated callback: invoke the callback with a runtime task,
re-render the context with that task as currentRuntimeTask, and assert
pendingTodoBinding records the runtime target. Preserve the existing
cloudProjectId, additionalContext, and pending-context assertions.

88-88: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Move the pending-context cleanup into afterEach.

useWorkbenchCloudProjectContext.ts keeps pendingTodoBinding in module scope (Line 56). The cleanup calls at Lines 88 and 122 run only when every preceding assertion passes. If an assertion fails, the module state survives into the next test and produces a second, unrelated failure. An afterEach hook makes the reset unconditional.

💚 Proposed fix
 describe('useWorkbenchCloudProjectContext', () => {
+  afterEach(() => {
+    const { result, unmount } = renderCloudContext()
+    act(() => result.current.clearPendingProjectContext())
+    unmount()
+  })
+
   test('prepares a pending backend project and task for runtime creation', async () => {

Import afterEach from vitest. A simpler alternative is to export a reset helper from the hook module for test use.

Also applies to: 122-122

🤖 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/layout/useWorkbenchCloudProjectContext.test.tsx` at
line 88, Move the clearPendingProjectContext cleanup out of individual test
bodies and into an unconditional afterEach hook in the test suite. Import
afterEach from vitest and invoke result.current.clearPendingProjectContext()
through the shared cleanup so module-scoped pendingTodoBinding is reset even
when assertions fail.
wework/src/components/layout/DesktopWorkbenchMain.tsx (1)

515-549: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Destructure the hook result directly and let the hook own composerCloudProject.

Two small points:

  1. cloudProjectContext at Line 515 is only used by the destructuring at Line 524. Destructure the call result directly.
  2. Line 549 recomputes currentRuntimeTask ? boundCloudProject : pendingCloudProject. The hook already derives the same value internally (composerCloudProject). Export it from the hook so the rule lives in one place.
♻️ Proposed fix
-  const cloudProjectContext = useWorkbenchCloudProjectContext({
+  const {
+    activeDeliveryItem,
+    boundCloudItem,
+    boundCloudProject,
+    clearCloudActionNotice,
+    clearPendingProjectContext,
+    clearTodoBindingError,
+    closeDeliveryDialog,
+    closeTodoBindingPicker,
+    cloudActionNotice,
+    composerCloudProject,
+    cloudProjectMentionCandidates,
+    deliveryDialogOpen,
+    finishLocalDelivery,
+    handleSelectCloudProject,
+    handleTodoBound,
+    openDelivery,
+    openTodoManager,
+    pendingCloudProject,
+    pendingTodoItem,
+    prepareSubmission,
+    todoBindingApis,
+    todoBindingError,
+    todoBindingPickerOpen,
+    visibleCloudMentionCandidates,
+  } = useWorkbenchCloudProjectContext({
     currentRuntimeTask,
     currentProjectId: currentProject?.id,
     defaultProjectSpace,
     paneKey,
     runtimeTaskTitle,
     services,
     userId: state.user?.id,
   })
-  const {
-    ...
-  } = cloudProjectContext
-  const composerCloudProject = currentRuntimeTask ? boundCloudProject : pendingCloudProject

Add composerCloudProject to the hook return object in useWorkbenchCloudProjectContext.ts.

As per coding guidelines: "Before adding code, search for and reuse existing components, services, utilities, and patterns; extract shared logic instead of duplicating it."

🤖 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/layout/DesktopWorkbenchMain.tsx` around lines 515 -
549, Destructure the result of useWorkbenchCloudProjectContext directly instead
of assigning cloudProjectContext first. Export composerCloudProject from the
hook’s return object in useWorkbenchCloudProjectContext.ts, then consume that
returned value in DesktopWorkbenchMain rather than recomputing it from
currentRuntimeTask, boundCloudProject, and pendingCloudProject.

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.

Inline comments:
In `@wework/src/components/layout/useWorkbenchCloudProjectContext.ts`:
- Around line 270-282: Add a rejection handler to the hydrateLocalWorkItems
promise in the local work-item path, alongside its existing success callback.
When hydration fails and the component remains active, clear the stale bound
cloud item and delivery item consistently with the cloud-path error handling,
while preserving the current success behavior.
- Around line 739-742: Wrap the returned clear and close callbacks in
useCallback within the context hook: clearCloudActionNotice,
clearTodoBindingError, and closeDeliveryDialog should have stable identities
with appropriate dependencies. Preserve their existing state-reset behavior so
TransientNotice can complete its timeout and DeliveryDialog can benefit from
memoization.
- Around line 349-359: The cloud mention loading flow should use the
project-space-specific API instead of always reading services.deliveryApi.
Update the API selection in the effect around composerCloudProject and the
Promise.all calls to use projectSpaceApiFor(composerCloudProject), preserving
the existing early return and loading behavior.

---

Nitpick comments:
In `@wework/src/components/layout/DesktopWorkbenchMain.tsx`:
- Around line 515-549: Destructure the result of useWorkbenchCloudProjectContext
directly instead of assigning cloudProjectContext first. Export
composerCloudProject from the hook’s return object in
useWorkbenchCloudProjectContext.ts, then consume that returned value in
DesktopWorkbenchMain rather than recomputing it from currentRuntimeTask,
boundCloudProject, and pendingCloudProject.

In `@wework/src/components/layout/useWorkbenchCloudProjectContext.test.tsx`:
- Around line 106-120: Extend the default-project selection test around
useWorkbenchCloudProjectContext to assert the delivery-scoped list APIs
listCloudFiles and listLoopItems are each called exactly once, alongside the
existing listCloudProjects assertion, preserving the intended
no-duplicate-request behavior.
- Around line 68-89: Add coverage in the pending-project test around
prepareSubmission and its onRuntimeTaskCreated callback: invoke the callback
with a runtime task, re-render the context with that task as currentRuntimeTask,
and assert pendingTodoBinding records the runtime target. Preserve the existing
cloudProjectId, additionalContext, and pending-context assertions.
- Line 88: Move the clearPendingProjectContext cleanup out of individual test
bodies and into an unconditional afterEach hook in the test suite. Import
afterEach from vitest and invoke result.current.clearPendingProjectContext()
through the shared cleanup so module-scoped pendingTodoBinding is reset even
when assertions fail.

In `@wework/src/components/layout/useWorkbenchCloudProjectContext.ts`:
- Line 246: Update the API assignments at the referenced call sites in the
workbench context to reuse the memoized `todoBindingApis` value created earlier,
removing repeated `projectSpaceApis(services)` calls while preserving the
existing API-list behavior.
- Around line 411-419: Update the delivery candidate mapping in the surrounding
effect to pass both the candidate title and reference-chip label through the
existing t function, using Chinese defaults and distinct translation keys for
each label. Preserve the delivery ID interpolation and cloud URL unchanged.
- Around line 643-645: In the submission setup, simplify the `submissionItem`
assignment to depend only on whether `currentRuntimeTask` is absent, since
`submissionProject` is derived from that same condition. Preserve
`pendingTodoItem` when no runtime task exists and return `null` otherwise;
update the expression near `submissionProject` without changing surrounding
behavior.
- Around line 448-469: Remove the unreachable catch handler from the
Promise.allSettled chain in the cloud-project loading flow, preserving the
existing fulfilled-result filtering and active-state guard in the then callback.
- Around line 159-167: Split useWorkbenchCloudProjectContext into focused hooks
aligned with its existing responsibilities: extract cloud project
binding/bound-context loading and mention candidate loading into cohesive hooks
such as useCloudProjectBinding and useCloudMentionCandidates, while keeping UI
action handlers separate. Preserve the current public context API and behavior,
and use clear English names and explicit interfaces for the extracted hooks.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d3d6e641-335f-4e54-ac86-cb596d5a4242

📥 Commits

Reviewing files that changed from the base of the PR and between 7ada919 and 86d7e11.

📒 Files selected for processing (3)
  • wework/src/components/layout/DesktopWorkbenchMain.tsx
  • wework/src/components/layout/useWorkbenchCloudProjectContext.test.tsx
  • wework/src/components/layout/useWorkbenchCloudProjectContext.ts

Comment thread wework/src/components/layout/useWorkbenchCloudProjectContext.ts Outdated
Comment thread wework/src/components/layout/useWorkbenchCloudProjectContext.ts Outdated
Comment thread wework/src/components/layout/useWorkbenchCloudProjectContext.ts Outdated
@qdaxb
qdaxb added this pull request to the merge queue Aug 9, 2026
Merged via the queue into main with commit 0107e84 Aug 9, 2026
47 checks passed
@qdaxb
qdaxb deleted the refactor/wework-cloud-project-context branch August 9, 2026 03:55
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