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

Function squadLatestPostsQueryOptions

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

Source from the content-addressed store, hash-verified

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

Callers 1

SquadUpdatesWidgetFunction · 0.90

Calls 1

generateQueryKeyFunction · 0.90

Tested by

no test coverage detected