MCPcopy Create free account
hub / github.com/dailydotdev/apps / picksViewCountQueryOptions

Function picksViewCountQueryOptions

packages/shared/src/graphql/picks.ts:314–326  ·  view source on GitHub ↗
(
  id: string,
  user?: Pick<LoggedUser, 'id'>,
)

Source from the content-addressed store, hash-verified

312 * carry an author-only field.
313 */
314export const picksViewCountQueryOptions = (
315 id: string,
316 user?: Pick<LoggedUser, 'id'>,
317) => ({
318 queryKey: generateQueryKey(RequestKey.Picks, user, id, 'viewCount'),
319 queryFn: async (): Promise<number | null> => {
320 const data = await gqlClient.request<{
321 picks: { viewCount: number | null } | null;
322 }>(PICKS_VIEW_COUNT_QUERY, { id });
323 return data.picks?.viewCount ?? null;
324 },
325 staleTime: 0,
326});
327
328/** Counts the viewer once per list on the API; the author is never counted. */
329export const trackPicksView = async (id: string): Promise<void> => {

Callers 2

useWeeklyPicksHeroFunction · 0.90
PicksPageFunction · 0.90

Calls 1

generateQueryKeyFunction · 0.90

Tested by

no test coverage detected