( currentBookmarks: number | null | undefined, isCurrentlyBookmarked: boolean | null | undefined, )
| 74 | }; |
| 75 | |
| 76 | const getOptimisticBookmarkCount = ( |
| 77 | currentBookmarks: number | null | undefined, |
| 78 | isCurrentlyBookmarked: boolean | null | undefined, |
| 79 | ): number => { |
| 80 | const delta = isCurrentlyBookmarked ? -1 : 1; |
| 81 | return Math.max(0, (currentBookmarks ?? 0) + delta); |
| 82 | }; |
| 83 | |
| 84 | export type UseBookmarkPost = { |
| 85 | toggleBookmark: (props: ToggleBookmarkProps) => Promise<void>; |
no outgoing calls
no test coverage detected