({
user,
sourceId,
}: {
user?: Pick<LoggedUser, 'id'>;
sourceId: string;
})
| 263 | export const SOURCE_SPOTLIGHT_POSTS_LIMIT = 8; |
| 264 | |
| 265 | export const sourceSpotlightPostsQueryOptions = ({ |
| 266 | user, |
| 267 | sourceId, |
| 268 | }: { |
| 269 | user?: Pick<LoggedUser, 'id'>; |
| 270 | sourceId: string; |
| 271 | }) => ({ |
| 272 | queryKey: generateQueryKey( |
| 273 | RequestKey.Search, |
| 274 | user, |
| 275 | 'spotlight-source-posts', |
| 276 | sourceId, |
| 277 | ), |
| 278 | queryFn: async (): Promise<SourceSpotlightPost[]> => { |
| 279 | const { page } = await gqlClient.request<{ |
| 280 | page: Connection<SourceSpotlightPost>; |
| 281 | }>(SOURCE_SPOTLIGHT_POSTS_QUERY, { |
| 282 | source: sourceId, |
| 283 | first: SOURCE_SPOTLIGHT_POSTS_LIMIT, |
| 284 | supportedTypes: baseFeedSupportedTypes, |
| 285 | }); |
| 286 | |
| 287 | return page.edges.map(({ node }) => node); |
| 288 | }, |
| 289 | staleTime: StaleTime.Default, |
| 290 | }); |
| 291 | |
| 292 | export const SEARCH_TAG_SUGGESTIONS = gql` |
| 293 | query SearchTagSuggestions($query: String!, $version: Int, $limit: Int) { |
no test coverage detected