Skip to content

🐛(frontend) fix loading comments transaction#2273

Merged
AntoLC merged 1 commit intomainfrom
fix/patch-doc-with-comment
May 6, 2026
Merged

🐛(frontend) fix loading comments transaction#2273
AntoLC merged 1 commit intomainfrom
fix/patch-doc-with-comment

Conversation

@AntoLC
Copy link
Copy Markdown
Collaborator

@AntoLC AntoLC commented May 6, 2026

Purpose

When we load the comments we have to notify the subscribers of the DocsThreadStore. This generates a Yjs transaction that is currently treated as a user-initiated content change that will trigger a patch request when the doc will try to save.
We now update the transaction origin when we notify the subscribers so that we can reliably identify and ignore those transactions in the useSaveDoc hook.

@AntoLC AntoLC self-assigned this May 6, 2026
@AntoLC AntoLC added bug Something isn't working frontend labels May 6, 2026
@AntoLC AntoLC force-pushed the fix/patch-doc-with-comment branch from f3b37ee to 37eaf6a Compare May 6, 2026 09:20
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Size Change: 0 B

Total Size: 4.24 MB

📦 View Changed
Filename Size Change
apps/impress/out/_next/static/7a7082b4/_buildManifest.js 0 B -634 B (removed) 🏆
apps/impress/out/_next/static/10afde95/_buildManifest.js 634 B +634 B (new file) 🆕

compressed-size-action

@AntoLC AntoLC requested a review from Ovgodd May 6, 2026 11:20
@AntoLC
Copy link
Copy Markdown
Collaborator Author

AntoLC commented May 6, 2026

@CodeRabbit review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f898917e-2fa6-484f-96f2-fdf892ae4e93

📥 Commits

Reviewing files that changed from the base of the PR and between 85128c7 and 37eaf6a.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • src/frontend/apps/impress/src/features/docs/doc-editor/components/comments/DocsThreadStore.tsx
  • src/frontend/apps/impress/src/features/docs/doc-editor/components/comments/useComments.ts
  • src/frontend/apps/impress/src/features/docs/doc-editor/hook/useSaveDoc.tsx

Walkthrough

The PR implements Yjs transaction integration for comment updates to fix loading comments transaction behavior. A new origin constant (COMMENT_UPDATE_ORIGIN) is introduced to mark comment-driven updates. The DocsThreadStore now accepts an optional Y.Doc parameter and wraps subscriber notifications within Yjs transactions when a document is present. The useSaveDoc hook imports this origin constant and filters out comment-originated updates to prevent them from being marked as local changes. Additionally, the useComments dependency array is updated to recompute the threadStore when the document changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Suggested reviewers

  • Ovgodd
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix loading comments transaction' directly relates to the main purpose of the changeset: preventing Yjs transactions from comment loading from being treated as user-initiated changes.
Description check ✅ Passed The description clearly explains the bug being fixed: comment loading generates Yjs transactions that were incorrectly treated as user changes, and the solution uses transaction origins to identify and ignore them.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/patch-doc-with-comment

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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 and usage tips.

@AntoLC AntoLC force-pushed the fix/patch-doc-with-comment branch from 37eaf6a to 47c7699 Compare May 6, 2026 13:41
When we load the comments we have to notify the
subscribers of the DocsThreadStore. This generates
a Yjs transaction that is currently treated as a
user-initiated content change that will trigger
a patch request when the doc will try to save.
We now update the transaction origin when we notify
the subscribers so that we can reliably identify
and ignore those transactions in the useSaveDoc
hook.
@AntoLC AntoLC force-pushed the fix/patch-doc-with-comment branch from 47c7699 to bd662d7 Compare May 6, 2026 13:56
@AntoLC AntoLC merged commit bd662d7 into main May 6, 2026
32 checks passed
@AntoLC AntoLC deleted the fix/patch-doc-with-comment branch May 6, 2026 14:18
@AntoLC AntoLC linked an issue May 6, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛Multiple PATCH Save

2 participants