Conversation
📝 WalkthroughWalkthroughBumps 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
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Summary by CodeRabbit
New Features
Refactor
Chores
✏️ Tip: You can customize this high-level summary in your review settings.