Skip to content

Migrate comment mutations#3121

Merged
feruzm merged 8 commits intodevelopmentfrom
comments
Feb 21, 2026
Merged

Migrate comment mutations#3121
feruzm merged 8 commits intodevelopmentfrom
comments

Conversation

@feruzm
Copy link
Member

@feruzm feruzm commented Feb 20, 2026

Summary by CodeRabbit

  • Refactor
    • Comment and post actions moved to an authenticated mutation flow; legacy local comment cache updates and pin-code wiring removed.
  • Bug Fixes
    • Improved WebSocket reconnection when the app returns to foreground.
    • Drafts and scheduled posts reliably refresh after add/update/delete operations.
  • Chore
    • App version bumped to 3.5.2.

@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Migrations move comment/post create/update/delete flows from in-repo dhive wrappers and Redux comment cache to SDK mutation hooks (useComment, useDeleteComment, useCommentMutations) with useAuthContext; removes comment cache actions/selectors/reducer, updates parsing and waves/discussion cache handling, and bumps app version metadata.

Changes

Cohort / File(s) Summary
Comment/Delete UI components
src/components/comments/container/commentsContainer.tsx, src/components/postComments/container/postComments.tsx, src/components/postOptionsModal/container/postOptionsModal.tsx, src/components/comment/view/commentView.tsx
Replaced direct dhive/hive delete/post calls with SDK mutation hooks (useDeleteComment / useComment), added useAuthContext, removed pinCode usage, call mutateAsync for deletions/posts, extended delete handler to include parent author/permlink, and update local UI state on success.
Editor & Quick-post flows
src/screens/editor/container/editorContainer.tsx, src/components/quickPostModal/usePostSubmitter.ts
Integrated useCommentMutations() (useComment/useUpdateReply); replaced postComment and optimistic Redux cache actions with mutateAsync calls; introduced rootAuthor/rootPermlink derivation; removed optimistic cache/observer/rollback logic.
Query hooks & mutations
src/providers/queries/postQueries/commentQueries.ts, src/providers/queries/postQueries/postQueries.ts, src/providers/queries/postQueries/wavesQueries.ts
Added useCommentMutations() to expose comment/update/delete mutations with auth context; replaced broadcast-based deletion with useDeleteComment; simplified discussion/waves handling and switched to per-comment vote cache injection; removed synthetic initial-data and complex invalidation branches.
Legacy Hive provider removal
src/providers/hive/dhive.ts
Removed exported high-level deleteComment and postComment wrappers and their HiveAuth/HiveSigner/private-key broadcast logic (functionality delegated to SDK/hooks).
Redux cache removal
src/redux/actions/cacheActions.ts, src/redux/constants/constants.ts, src/redux/reducers/cacheReducer.ts, src/redux/selectors/index.ts
Removed updateCommentCache / deleteCommentCacheEntry actions and constants, selectCommentsCollection selector, commentsCollection state and Comment interface, reducer cases and purge logic related to comment caching.
Post parser API change
src/utils/postParser.tsx
Changed injectPostCache signature to (commentsMap, cachedVotes) and removed handling of cachedComments and synthetic comment processing; retained vote cache injection.
Hive auth & websocket robustness
patches/hive-auth-wrapper+1.0.0.patch, node_modules/hive-auth-wrapper/has-wrapper.js, src/components/hiveAuthModal/hooks/useHiveAuth.ts
Added concurrency guard and safer lifecycle handling to HAS websocket wrapper; added AppState foreground-resume logic to force HAS reconnection in useHiveAuth.
Drafts cache invalidation
src/providers/queries/draftQueries.ts
Added useQueryClient usage and infinite-query keys; new useGetDraftsQuery/useGetSchedulesQuery; added invalidation of drafts/schedules infinite queries after mutations.
Version bumps & metadata
package.json, android/app/build.gradle, ios/*/Info.plist, ios/*.pbxproj
Bumped package/app version from 3.5.1 → 3.5.2 and iOS build numbers from 26 → 27.
Misc
src/components/hiveAuthModal/hooks/useHiveAuth.ts, src/components/comment/view/commentView.tsx
Added app state listener wiring to useHiveAuth; adjusted commentView prop default for mainAuthor and updated delete callback argument usage.

Sequence Diagram(s)

sequenceDiagram
  participant UI as rgba(52,152,219,0.5) Component (UI)
  participant Auth as rgba(46,204,113,0.5) AuthContext
  participant SDK as rgba(155,89,182,0.5) SDK Hook
  participant API as rgba(241,196,15,0.5) Backend API
  participant Cache as rgba(231,76,60,0.5) Local UI / Query Cache

  UI->>Auth: obtain auth context/credentials
  UI->>SDK: call mutateAsync(payload)
  SDK->>Auth: sign/authorize request
  SDK->>API: send post/delete request
  API-->>SDK: success / error
  SDK-->>UI: mutation result
  alt success
    UI->>Cache: update local UI state / remove item
  else error
    UI->>UI: show error toast/log
  end
Loading

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly Related PRs

Suggested Labels

deploy-pr-build

Poem

🐰 I nibbled code and found a hook,
Mutations hum where old calls shook,
Caches quiet, websockets mend,
Auth at paw — a safer send,
Carrot hop, a tidy merge — tada, done!

🚥 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 pull request title 'Migrate comment mutations' clearly and accurately summarizes the main objective of the changeset, which involves migrating comment-related operations from direct Hive API calls to mutation-based hooks from the @ecency/sdk.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch comments

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.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@feruzm feruzm merged commit 0923c1f into development Feb 21, 2026
1 check was pending
@feruzm feruzm deleted the comments branch February 21, 2026 14:09
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