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

Function generateCommentsQueryKey

packages/shared/src/lib/query.ts:589–600  ·  view source on GitHub ↗
({
  postId,
  sortBy,
}: GenerateCommentsQueryKeyProps)

Source from the content-addressed store, hash-verified

587}
588
589export const generateCommentsQueryKey = ({
590 postId,
591 sortBy,
592}: GenerateCommentsQueryKeyProps): QueryKeyReturnType =>
593 generateQueryKey(
594 RequestKey.PostComments,
595 undefined,
596 // Filter out undefined to ensure key matches after JSON serialization
597 Object.fromEntries(
598 Object.entries({ postId, sortBy }).filter(([, v]) => v !== undefined),
599 ),
600 );
601
602export const getAllCommentsQuery = (postId: string): QueryKeyReturnType[] => {
603 const sorting = Object.values(SortCommentsBy).map((sortBy) =>

Callers 5

seedFunction · 0.90
usePostCommentsFunction · 0.90
CompanionDiscussionFunction · 0.90
getAllCommentsQueryFunction · 0.85

Calls 1

generateQueryKeyFunction · 0.85

Tested by

no test coverage detected