()
| 25 | }; |
| 26 | |
| 27 | export const useUpvoteQuery = (): UseUpvoteQuery => { |
| 28 | const { modal, openModal } = useLazyModal<LazyModal.UpvotedPopup>(); |
| 29 | const onShowUpvoted = ( |
| 30 | id: string, |
| 31 | upvotes: number, |
| 32 | type: UpvoteType = 'post', |
| 33 | ) => { |
| 34 | openModal({ |
| 35 | type: LazyModal.UpvotedPopup, |
| 36 | props: { |
| 37 | placeholderAmount: upvotes, |
| 38 | requestQuery: { |
| 39 | queryKey: [KEY_MAP[type], id], |
| 40 | query: QUERY_MAP[type], |
| 41 | params: { id, first: DEFAULT_UPVOTES_PER_PAGE }, |
| 42 | }, |
| 43 | }, |
| 44 | }); |
| 45 | }; |
| 46 | |
| 47 | return useMemo( |
| 48 | () => ({ onShowUpvoted, queryKey: modal?.props?.requestQuery?.queryKey }), |
| 49 | // @NOTE see https://dailydotdev.atlassian.net/l/cp/dK9h1zoM |
| 50 | // eslint-disable-next-line react-hooks/exhaustive-deps |
| 51 | [modal], |
| 52 | ); |
| 53 | }; |
no test coverage detected