MCPcopy Create free account
hub / github.com/dailydotdev/apps / mutationHandler

Function mutationHandler

packages/shared/src/hooks/useBookmarkPost.ts:304–321  ·  view source on GitHub ↗
(post?: Post)

Source from the content-addressed store, hash-verified

302 }
303
304 const mutationHandler = (post?: Post) => {
305 const isBookmarked = !post?.bookmarked;
306 const nextBookmarks = getOptimisticBookmarkCount(
307 post?.analytics?.bookmarks,
308 post?.bookmarked,
309 );
310
311 return {
312 bookmarked: isBookmarked,
313 bookmark: !isBookmarked ? undefined : post?.bookmark,
314 analytics: post?.analytics
315 ? {
316 ...post.analytics,
317 bookmarks: nextBookmarks,
318 }
319 : post?.analytics,
320 };
321 };
322
323 const rollbackFunctions: (() => void)[] = [];
324

Callers 7

mutateBookmarkFeedPostFunction · 0.70
useOnPostClickFunction · 0.70
trySetPostReadFunction · 0.70
CommentActionButtonsFunction · 0.50
CommentActionButtonsV1Function · 0.50
mutateVoteFeedPostFunction · 0.50

Calls 1

Tested by

no test coverage detected