Skip to content

SDK missing mutation for mobile app#626

Merged
feruzm merged 4 commits into
developfrom
msdk
Jan 21, 2026
Merged

SDK missing mutation for mobile app#626
feruzm merged 4 commits into
developfrom
msdk

Conversation

@feruzm
Copy link
Copy Markdown
Member

@feruzm feruzm commented Jan 21, 2026

Summary by CodeRabbit

  • New Features

    • Notification marking with optimistic updates
    • New post mutation hooks: add/update/delete drafts, add/move/delete schedules, add/delete/upload images
  • Refactor

    • Post fragment mutations now accept fragment ID via mutation payload
    • Vesting delegations query converted to infinite-scroll pagination
  • Chores

    • Package version bumped to 1.5.14
    • Additional module re-exports for notifications and posts APIs

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

Bumps SDK to 1.5.14, adds multiple posts-related React-Query mutation hooks and re-exports, introduces a notifications mutation hook with optimistic updates and rollback, refactors post fragment mutations to use payload-scoped fragmentId, and converts vesting-delegations query to infinite pagination.

Changes

Cohort / File(s) Summary
Version & metadata
packages/sdk/package.json
Version updated from 1.5.131.5.14
Notifications module
packages/sdk/src/modules/notifications/index.ts, packages/sdk/src/modules/notifications/mutations/index.ts, packages/sdk/src/modules/notifications/mutations/use-mark-notifications-read.ts
Added re-exports; new useMarkNotificationsRead hook implementing optimistic updates, rollback on error, unread-count handling, and notifications cache invalidation
Posts — fragment mutations
packages/sdk/src/modules/posts/mutations/edit-fragment.ts, packages/sdk/src/modules/posts/mutations/remove-fragment.ts
Removed fragmentId from outer hook signatures; moved fragmentId into mutation payloads; updated mutation keys, mutationFn args, and onSuccess handlers to use variables.fragmentId
Posts — new draft hooks & exports
packages/sdk/src/modules/posts/mutations/use-add-draft.ts, .../use-update-draft.ts, .../use-delete-draft.ts, packages/sdk/src/modules/posts/mutations/index.ts
Added useAddDraft, useUpdateDraft, useDeleteDraft hooks that validate auth, call API, and invalidate drafts queries; exported via mutations index
Posts — new schedule hooks & exports
packages/sdk/src/modules/posts/mutations/use-add-schedule.ts, .../use-delete-schedule.ts, .../use-move-schedule.ts, packages/sdk/src/modules/posts/mutations/index.ts
Added schedule management hooks (add, delete, move) with auth checks and query invalidation; exported via mutations index
Posts — new image hooks & exports
packages/sdk/src/modules/posts/mutations/use-add-image.ts, .../use-delete-image.ts, .../use-upload-image.ts, packages/sdk/src/modules/posts/mutations/index.ts
Added image management hooks (add, delete, upload) with auth validation, upload handling, and query invalidation; exported via mutations index
Wallet — vesting delegations query & call site
packages/sdk/src/modules/wallet/queries/get-vesting-delegations-query-options.ts, apps/web/src/features/shared/transfer/use-debounce-transfer-account-data.ts
Converted from queryOptions → infiniteQueryOptions; removed from param, added pageParam cursor and limit; updated app call site to new signature

Sequence Diagram

sequenceDiagram
    participant User
    participant Hook as useMarkNotificationsRead
    participant Cache as Query\ Cache
    participant API as Backend\ API
    participant Callback as onSuccess/onError

    User->>Hook: invoke(username, code, callbacks)
    Hook->>Cache: onMutate — save previous notifications state
    Hook->>Cache: optimistic update — set notifications[].read
    Hook->>API: markNotifications(request with auth)
    alt success
        API-->>Hook: success (maybe unread count)
        Hook->>Callback: onSuccess(unreadCount?)
        Hook->>Cache: invalidate notifications queries
    else error
        API-->>Hook: error
        Hook->>Cache: rollback to saved state
        Hook->>Callback: onError(error)
        Hook->>Cache: invalidate notifications queries
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I hopped through hooks, exports, and more,
I marked the bell and toggled "read" once more,
Drafts and images lined up in a row,
Fragments nudged to payloads — off they go,
SDK hops forward — tiny feet, big glow ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.71% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title 'SDK missing mutation for mobile app' is vague and overly broad—it doesn't clearly specify which mutations were added, what changes were made, or the primary objective of the changeset. Revise the title to be more specific and descriptive, such as 'Add useMarkNotificationsRead mutation and expand post mutations exports' to clearly communicate the main changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@packages/sdk/src/modules/wallet/queries/get-vesting-delegations-query-options.ts`:
- Around line 27-36: The pagination duplicates happen because Hive's
get_vesting_delegations is inclusive of the from cursor; update the fetch logic
that builds the page (the code that uses pageParam and produces the delegations
array) to filter out the repeated first item when pageParam is set (i.e., when
not the first page). Mirror the RC delegations approach: when pageParam is
truthy, remove the delegation whose delegatee equals pageParam from delegations
before returning the page; keep getNextPageParam (which returns
lastDelegation?.delegatee) and limit logic unchanged.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@packages/sdk/src/modules/wallet/queries/get-vesting-delegations-query-options.ts`:
- Around line 18-41: The pagination breaks because you filter the inclusive
duplicate (in queryFn) but still use the post-filter length to decide
continuation in getNextPageParam; modify queryFn to request limit+1 from
CONFIG.hiveClient.database.call when pageParam is provided, then if pageParam is
set slice off the duplicate first item and return at most limit items, and
modify getNextPageParam to base the "end" check on the fetched raw count (i.e.,
whether the fetched array length was <= limit) or alternatively detect
continuation by whether the original fetched array length was > limit; use the
existing symbols queryFn, getNextPageParam, CONFIG.hiveClient.database.call,
pageParam, limit, DelegatedVestingShare and lastDelegation to implement this so
next page is only undefined when there truly are no more items.

@feruzm feruzm merged commit 04c0d3e into develop Jan 21, 2026
1 check passed
@feruzm feruzm deleted the msdk branch January 21, 2026 12:18
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