(post?: Post)
| 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 |
no test coverage detected