Skip to content

Conversation

@feruzm
Copy link
Member

@feruzm feruzm commented Feb 12, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Optimistic replies now remain visible until confirmed by the network, preventing premature disappearance after posting.
  • Refactor

    • Improved discussion caching so drafts and optimistic comments are preserved during data refreshes, yielding a more consistent feed and smoother post-confirmation updates.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Removed the manual cache mutation that flipped is_optimistic in the web mutation; added a structuralSharing merge in the SDK's discussions query options to preserve optimistic entries across refetches until the blockchain indexes them.

Changes

Cohort / File(s) Summary
Web mutation change
apps/web/src/api/mutations/create-reply.ts
Removed manual cache update that flipped is_optimistic to false after blockchain confirmation; rely on SDK invalidation instead.
SDK query options
packages/sdk/src/modules/posts/queries/get-discussions-query-options.ts
Added explicit Entry[] typing for select and a structuralSharing function that preserves optimistic entries by merging missing optimistic items from old data into new data.
Changelog
packages/sdk/CHANGELOG.md
Text updates: replaced and added lines in the 2.0.1 patch changes referencing optimistic updates (#651, #652).

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Web as Web App
participant SDK as SDK Query Layer
participant Tx as Blockchain / Indexer
Web->>SDK: createReply mutation (optimistic entry added)
SDK-->>Web: returns optimistic entry (is_optimistic: true)
Web->>Tx: broadcast transaction
Tx-->>SDK: index new comment (eventual consistency)
SDK->>SDK: refetch discussions
SDK->>SDK: structuralSharing merges old optimistic entries into new results if missing
SDK-->>Web: updated discussions (optimistic entry preserved until indexed)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰
Hopped a note into the cache so bright,
Kept my hopes till the chain saw the light.
No flag to flip, the SDK mends,
Merging whispers from optimistic friends.
A tiny hop — the data's right. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix optimistic replies' directly corresponds to the main changes, which fix how optimistic entries are handled in reply mutations by improving cache management and structural sharing.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch mutation

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.

@feruzm feruzm added the patch:sdk Patch bump for @ecency/sdk label Feb 12, 2026
@feruzm feruzm merged commit e9e33cd into develop Feb 12, 2026
@feruzm feruzm deleted the mutation branch February 12, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch:sdk Patch bump for @ecency/sdk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant