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

Function squadLatestPostsQueryOptions

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

Source from the content-addressed store, hash-verified

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

Callers 1

SquadUpdatesWidgetFunction · 0.90

Calls 1

generateQueryKeyFunction · 0.90

Tested by

no test coverage detected