Skip to content

feat(activity-feed-v2): swap in TaskModalV2 and scroll to new tasks#4671

Merged
mergify[bot] merged 2 commits into
box:masterfrom
jackiejou:feat/task-modal-v2-swap
Jul 1, 2026
Merged

feat(activity-feed-v2): swap in TaskModalV2 and scroll to new tasks#4671
mergify[bot] merged 2 commits into
box:masterfrom
jackiejou:feat/task-modal-v2-swap

Conversation

@jackiejou

@jackiejou jackiejou commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Swap v1 TaskModal for TaskModalV2 inside ActivityFeedV2, using the flat prop shape and discriminated mode union.
  • Bridge the loosely typed ActivityFeedV2Props.createTask / onTaskUpdate to the strict CreateTaskCallback / EditTaskCallback via small adapters; return a synthetic ElementsXhrError when either is unwired so the modal never gets stuck in a submitting state.
  • Tighten local state types: taskType: string -> TaskType; taskError: Error | null -> ElementsXhrError | undefined.
  • Extend the post-mutation scroll snapshot to also match newly created tasks whose author is the current user, mirroring the existing comment / annotation behavior.

Test plan

  • Unit tests: yarn test --watchAll=false --testPathPattern="activity-feed-v2" (11 suites, 328 tests) pass.
  • Create a task from ActivityFeedV2: modal opens, submits, closes, and the feed auto-scrolls to the new task.
  • Edit an existing task from ActivityFeedV2: modal seeds fields, submits, and closes.
  • Missing createTask prop: modal surfaces an error and returns to an interactive state instead of hanging.
  • Missing onTaskUpdate prop: same as above for edit path.
  • Verify no v1 TaskModal references remain in activity-feed-v2/.

Summary by CodeRabbit

  • New Features

    • Updated the activity feed’s task experience to use the latest task modal workflow.
    • Enhanced “scroll to authored items” so task entries authored by the current user are included.
  • Bug Fixes

    • Improved task error handling with clearer “action unavailable” states for create and edit.
    • Refined task modal close behavior to properly clear task-related errors.
  • Tests

    • Expanded coverage to verify modal prop wiring, error propagation, and scrolling behavior for authored vs. non-authored tasks.

- Replace v1 TaskModal with TaskModalV2 in ActivityFeedV2
- Adapt loosely typed createTask/onTaskUpdate props to strict callbacks
- Extend post-mutation scroll snapshot to include newly created tasks
@jackiejou jackiejou requested review from a team as code owners July 1, 2026 19:21
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b40204eb-56a9-4391-8cd8-10954b02cc05

📥 Commits

Reviewing files that changed from the base of the PR and between e620170 and f520cd9.

📒 Files selected for processing (1)
  • src/elements/content-sidebar/activity-feed-v2/__tests__/ActivityFeedV2.test.tsx

Walkthrough

ActivityFeedV2 replaces the legacy TaskModal with TaskModalV2, updates task state and error handling, extends scroll targeting to authored task items, and wires new create/edit adapters plus matching test coverage.

Changes

TaskModalV2 Migration

Layer / File(s) Summary
Imports and prop updates for TaskModalV2
src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx
TaskModal import swapped for TaskModalV2, v2 task type imports and TASK_TYPE_APPROVAL added, legacy approver-selector props removed from destructuring.
Task state, error typing, and scroll-to-authored logic
src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx
taskType/taskError state retyped to TaskType/`ElementsXhrError
Create/edit handlers and TaskModalV2 wiring
src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx
New handleCreateTask/handleEditTask adapters wrap task callbacks, snapshot known ids on success, and emit ElementsXhrError when callbacks are unavailable; render swaps legacy TaskModal for TaskModalV2 wired with the new handlers, taskType, error state, and success/close callbacks.
TaskModalV2 test wiring
src/elements/content-sidebar/activity-feed-v2/__tests__/ActivityFeedV2.test.tsx
Adds TaskModalV2 mocking and task-modal wiring tests for prop forwarding, callback flow, unavailable-create handling, submit-error propagation, and scroll behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested labels: ready-to-merge

Suggested reviewers: ahorowitz123, JChan106, zhirongwang

Poem

A rabbit hops through modal doors,
Old Task goes v2, paws and purrs.
Errors tucked in tidy place,
Scrolls now find each authored trace,
Thump-thump! The feed now softly stirs. 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description does not follow the repository's required ready-to-merge template and omits the template's merge-queue guidance. Rewrite the PR description to match the provided template, including the ready-to-merge guidance and required merge-queue details.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: replacing TaskModal with TaskModalV2 and updating task scroll behavior.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@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.

🧹 Nitpick comments (1)
src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx (1)

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

Consider deduplicating the shared TaskModalV2 props.

The edit/create branches repeat createTask, error, fetchAvatarUrls, fetchUsers, isOpen, onClose, onSubmitError, onSubmitSuccess, and taskType. Extracting these into a shared object and spreading it into each branch would reduce duplication while still satisfying the discriminated union.

♻️ Proposed refactor
+            {(() => {
+                const sharedModalProps = {
+                    createTask: handleCreateTask,
+                    error: taskError,
+                    fetchAvatarUrls,
+                    fetchUsers,
+                    isOpen: isTaskFormOpen,
+                    onClose: handleTaskModalClose,
+                    onSubmitError: setTaskError,
+                    onSubmitSuccess: handleTaskModalClose,
+                    taskType,
+                };
+                return editingTask ? (
+                    <TaskModalV2
+                        {...sharedModalProps}
+                        editingAssignees={editingAssignees?.entries ?? []}
+                        editingTask={editingTask}
+                        editTask={handleEditTask}
+                        mode="edit"
+                    />
+                ) : (
+                    <TaskModalV2 {...sharedModalProps} />
+                );
+            })()}
-            {editingTask ? (
-                <TaskModalV2
-                    createTask={handleCreateTask}
-                    editingAssignees={editingAssignees?.entries ?? []}
-                    editingTask={editingTask}
-                    editTask={handleEditTask}
-                    error={taskError}
-                    fetchAvatarUrls={fetchAvatarUrls}
-                    fetchUsers={fetchUsers}
-                    isOpen={isTaskFormOpen}
-                    mode="edit"
-                    onClose={handleTaskModalClose}
-                    onSubmitError={setTaskError}
-                    onSubmitSuccess={handleTaskModalClose}
-                    taskType={taskType}
-                />
-            ) : (
-                <TaskModalV2
-                    createTask={handleCreateTask}
-                    error={taskError}
-                    fetchAvatarUrls={fetchAvatarUrls}
-                    fetchUsers={fetchUsers}
-                    isOpen={isTaskFormOpen}
-                    onClose={handleTaskModalClose}
-                    onSubmitError={setTaskError}
-                    onSubmitSuccess={handleTaskModalClose}
-                    taskType={taskType}
-                />
-            )}
🤖 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 `@src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx` around
lines 505 - 533, The `TaskModalV2` render branches in `ActivityFeedV2` duplicate
most props between edit and create modes. Extract the shared props into a common
object near `handleTaskModalClose`/`handleCreateTask`, then spread that object
into both `TaskModalV2` branches while keeping the edit-only `editingTask`,
`editingAssignees`, `editTask`, and `mode` props only in the edit branch.
🤖 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 `@src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx`:
- Around line 505-533: The `TaskModalV2` render branches in `ActivityFeedV2`
duplicate most props between edit and create modes. Extract the shared props
into a common object near `handleTaskModalClose`/`handleCreateTask`, then spread
that object into both `TaskModalV2` branches while keeping the edit-only
`editingTask`, `editingAssignees`, `editTask`, and `mode` props only in the edit
branch.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0f2ecbf2-aec5-4a70-bd98-666dc586707c

📥 Commits

Reviewing files that changed from the base of the PR and between b35c40c and e620170.

📒 Files selected for processing (1)
  • src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx

- Mock TaskModalV2 to capture props via Partial<TaskModalV2Props>
- Assert create-mode props, adapter arg forwarding, and unavailable-callback path
- Assert scroll behavior after creating tasks (own vs stranger, missing target)
Comment thread src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx
@mergify

mergify Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-07-01 22:46 UTC · Rule: Automatic strict merge · triggered by rule Automatic merge queue
  • Checks skipped · PR is already up-to-date
  • Merged2026-07-01 22:46 UTC · at f520cd9a35238558b3e06e5caa809f9729307db0 · squash

This pull request spent 9 seconds in the queue, including 2 seconds running CI.

Required conditions to merge

@mergify mergify Bot merged commit f13b0a9 into box:master Jul 1, 2026
10 of 11 checks passed
@mergify mergify Bot removed the queued label Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants