({
sourceId,
user,
}: {
sourceId?: string;
user?: Pick<LoggedUser, 'id'>;
})
| 432 | const SQUAD_LATEST_POSTS_PAGE_SIZE = 20; |
| 433 | |
| 434 | export 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 | |
| 459 | export const SOURCE_REFERRAL_URL_QUERY = gql` |
| 460 | query SourceReferralUrl($id: ID!) { |
no test coverage detected