(post: Post)
| 291 | } |
| 292 | |
| 293 | const mutationHandler = (post: Post) => { |
| 294 | const isBookmarked = !post?.bookmarked; |
| 295 | const nextBookmarks = getOptimisticBookmarkCount( |
| 296 | post?.analytics?.bookmarks, |
| 297 | post?.bookmarked, |
| 298 | ); |
| 299 | |
| 300 | return { |
| 301 | bookmarked: isBookmarked, |
| 302 | bookmark: !isBookmarked ? undefined : post?.bookmark, |
| 303 | analytics: post?.analytics |
| 304 | ? { |
| 305 | ...post.analytics, |
| 306 | bookmarks: nextBookmarks, |
| 307 | } |
| 308 | : post?.analytics, |
| 309 | }; |
| 310 | }; |
| 311 | |
| 312 | const rollbackFunctions: (() => void)[] = []; |
| 313 |
no test coverage detected