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

Function squadLatestPostsQueryOptions

packages/shared/src/graphql/squads.ts:446–469  ·  view source on GitHub ↗
({
  sourceId,
  user,
}: {
  sourceId?: string;
  user?: Pick<LoggedUser, 'id'>;
})

Source from the content-addressed store, hash-verified

444const SQUAD_LATEST_POSTS_PAGE_SIZE = 20;
445
446export const squadLatestPostsQueryOptions = ({
447 sourceId,
448 user,
449}: {
450 sourceId?: string;
451 user?: Pick<LoggedUser, 'id'>;
452}) => ({
453 queryKey: generateQueryKey(RequestKey.Squad, user, sourceId, 'latest'),
454 queryFn: async (): Promise<Post[]> => {
455 const res = await gqlBatchRequest<FeedData>(SOURCE_FEED_QUERY, {
456 source: sourceId,
457 first: SQUAD_LATEST_POSTS_PAGE_SIZE,
458 loggedIn: !!user,
459 ranking: RankingAlgorithm.Time,
460 supportedTypes: baseFeedSupportedTypes,
461 });
462
463 return res.page.edges
464 .map(({ node }) => node)
465 .filter((post) => !post.pinnedAt);
466 },
467 enabled: !!sourceId,
468 staleTime: StaleTime.Default,
469});
470
471export const SOURCE_REFERRAL_URL_QUERY = gql`
472 query SourceReferralUrl($id: ID!) {

Callers 1

SquadUpdatesWidgetFunction · 0.90

Calls 1

generateQueryKeyFunction · 0.90

Tested by

no test coverage detected