Conversation
📝 WalkthroughWalkthroughThis PR introduces SDK-backed mutation hooks across web and SDK layers. Web-specific mutation wrappers are created that delegate to new SDK mutations via broadcast adapters. SDK mutations are added for comment deletion, post muting, and community subscription/unsubscription with post-broadcast cache invalidation. Export barrels are extended to expose these mutations. Changes
Sequence Diagram(s)sequenceDiagram
participant WebComponent
participant WebMutationWrapper as Web Mutation<br/>(useDeleteCommentMutation)
participant SDKMutation as SDK Mutation<br/>(useDeleteComment)
participant BroadcastAdapter
participant QueryCache
WebComponent->>WebMutationWrapper: mutate(payload)
WebMutationWrapper->>WebMutationWrapper: getActiveUser()
WebMutationWrapper->>WebMutationWrapper: createWebBroadcastAdapter()
WebMutationWrapper->>SDKMutation: mutate(username, auth)
SDKMutation->>BroadcastAdapter: buildDeleteCommentOp()
SDKMutation->>BroadcastAdapter: broadcast(operation)
BroadcastAdapter-->>SDKMutation: success
SDKMutation->>QueryCache: invalidateQueries(feeds)
SDKMutation->>QueryCache: invalidateQueries(discussions)
SDKMutation->>QueryCache: invalidateQueries(parent)
SDKMutation-->>WebMutationWrapper: result
WebMutationWrapper->>WebComponent: onSuccess(callback)
sequenceDiagram
participant WebComponent
participant WebMutationWrapper as Web Mutation<br/>(updateProfile)
participant SDKMutation as SDK Mutation<br/>(useAccountUpdate)
participant BroadcastAdapter
participant QueryCache
WebComponent->>WebMutationWrapper: mutate(profile)
WebMutationWrapper->>WebMutationWrapper: getActiveUser()
WebMutationWrapper->>WebMutationWrapper: createWebBroadcastAdapter()
WebMutationWrapper->>SDKMutation: mutate(username, auth)
SDKMutation->>QueryCache: optimisticUpdate(FullAccount)
SDKMutation->>BroadcastAdapter: buildAccountUpdateOp()
SDKMutation->>BroadcastAdapter: broadcast(operation)
BroadcastAdapter-->>SDKMutation: success
SDKMutation->>QueryCache: invalidateQueries(accounts/full)
SDKMutation-->>WebMutationWrapper: result
WebMutationWrapper->>WebComponent: onSuccess()
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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 |
Summary by CodeRabbit