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

Function sourceSpotlightPostsQueryOptions

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

Source from the content-addressed store, hash-verified

263export const SOURCE_SPOTLIGHT_POSTS_LIMIT = 8;
264
265export 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
292export const SEARCH_TAG_SUGGESTIONS = gql`
293 query SearchTagSuggestions($query: String!, $version: Int, $limit: Int) {

Callers 1

useSpotlightSourcePostsFunction · 0.90

Calls 1

generateQueryKeyFunction · 0.90

Tested by

no test coverage detected