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

Function mutationHandler

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

Source from the content-addressed store, hash-verified

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

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