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

Function reputationEventsQueryOptions

packages/shared/src/graphql/reputation.ts:227–255  ·  view source on GitHub ↗
({
  user,
  filter = ReputationEventFilter.All,
}: {
  user: ReputationUser;
  filter?: ReputationEventFilter;
})

Source from the content-addressed store, hash-verified

225
226/** Spread into `useInfiniteQuery`. */
227export const reputationEventsQueryOptions = ({
228 user,
229 filter = ReputationEventFilter.All,
230}: {
231 user: ReputationUser;
232 filter?: ReputationEventFilter;
233}) => ({
234 queryKey: generateQueryKey(
235 RequestKey.ReputationEvents,
236 user ?? undefined,
237 filter,
238 ),
239 queryFn: async ({ pageParam }: { pageParam?: string }) => {
240 const { reputationEvents } = await gqlClient.request<{
241 reputationEvents: Connection<ReputationEvent>;
242 }>(REPUTATION_EVENTS_QUERY, {
243 after: pageParam,
244 first: reputationEventsPageSize,
245 filter,
246 });
247
248 return reputationEvents;
249 },
250 initialPageParam: '',
251 getNextPageParam: (lastPage: Connection<ReputationEvent>) =>
252 getNextPageParam(lastPage?.pageInfo),
253 enabled: !!user,
254 staleTime: StaleTime.Default,
255});
256
257/** The newest gain, which is what earned the first reputation moment. */
258export const FIRST_REPUTATION_GAIN_QUERY = gql`

Callers 1

ReputationDashboardFunction · 0.90

Calls 2

generateQueryKeyFunction · 0.90
getNextPageParamFunction · 0.90

Tested by

no test coverage detected