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