Skip to content

refactor(collaboration, notifications): name the presenters' state updates instead of runInAction - #5997

Merged
adrians5j merged 1 commit into
nextfrom
claude/refactor-collab-presenter-actions
Oct 14, 2026
Merged

adrians5j merged 1 commit into
nextfrom
claude/refactor-collab-presenter-actions

Conversation

@adrians5j

@adrians5j adrians5j commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

CommentsPresenter (collaboration) and NotificationsPresenter (notifications) changed state after an await through inline runInAction blocks: 11 in the first, 5 in the second. Each block is now a named private method. makeAutoObservable makes every method an action, so an update made after an await still runs inside one. This is the pattern ai-context/code-style/presenter-owns-component-state.md describes. The code came over from 6.5.0 in #5955 with the inline blocks, and this cleanup was left for a separate change.

No behaviour change. The methods hold exactly the assignments the blocks held, in the same order. That includes the notifications presenter's check that only the latest request writes the visible list.

Testing

  • yarn check passes for @webiny/collaboration and @webiny/notifications. Neither package has tests.
  • Every converted path, run in the admin with no console errors:
    • Comments: the panel loads an entry's threads. Posting a comment adds it. Resolve, reopen and delete each update the thread list.
    • Inbox: the counts load (Inbox 1, Archive 2), and the Archive tab lists its items.

Workspace: wby-next2 · 🧹 MERGE 6.5.0 => NEXT

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Improvements
    • Comment and notification screens continue to show loading progress, updated results, and readable error feedback as data loads. Notification results and loading indicators remain in sync with the most recent request.

…dates instead of runInAction

CommentsPresenter and NotificationsPresenter changed state after an
await through inline runInAction blocks. Each block is now a named
private method. makeAutoObservable makes those methods actions, so the
updates still run inside one, as presenter-owns-component-state.md
describes. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🚓 Slop Cop

✅ Nothing worth flagging. The diff looks consistent with the PR's stated intent and the code-style rules.

The PR matches its stated intent (converting inline runInAction blocks into named private methods in two presenters), with no footprint mismatch, no secrets/artifacts, no debug leftovers, and no style-rule violations in the added code.

Automated, non-blocking heads-up from an LLM. It can be wrong — use your judgment. Regenerates on every push.

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 637523ec-eb2c-44d7-bda5-d14d9c16bad1
📥 Commits

Reviewing files that changed from the base of the PR and between 61a9527 and 3aec383.

📒 Files selected for processing: 2
  • packages/collaboration/src/admin/presentation/comments/CommentsPresenter.ts
  • packages/notifications/src/admin/presentation/notifications/NotificationsPresenter.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.

📝 Walkthrough

The comments and notifications presenters remove explicit runInAction wrappers and delegate observable state updates to helper methods. Their existing request handling and result behavior remain in place.

Changes: Comments Presenter

Layer / File(s) Summary
Comments state updates
packages/collaboration/src/admin/presentation/comments/CommentsPresenter.ts
Composer, initialization, user, loading, and thread updates now use helper methods. makeAutoObservable infers these methods as actions. Reload retains its success and error handling.

Notifications Presenter

Layer / File(s) Summary
Notification state updates
packages/notifications/src/admin/presentation/notifications/NotificationsPresenter.ts
Item loading, result storage, error handling, and count updates now use helper methods. Item caching and latest-request handling remain unchanged.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 3aec3

The presenter state-update refactor is mergeable after normal checks.

Pre-merge checks: Passed 5
Passed 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 refactor in both presenters: replacing inline runInAction usage with named state-update methods.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
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 docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@adrians5j
adrians5j merged commit 8731447 into next Oct 14, 2026
19 checks passed
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