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