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

Function generateCommentsQueryKey

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

Source from the content-addressed store, hash-verified

626}
627
628export const generateCommentsQueryKey = ({
629 postId,
630 sortBy,
631}: GenerateCommentsQueryKeyProps): QueryKeyReturnType =>
632 generateQueryKey(
633 RequestKey.PostComments,
634 undefined,
635 // Filter out undefined to ensure key matches after JSON serialization
636 Object.fromEntries(
637 Object.entries({ postId, sortBy }).filter(([, v]) => v !== undefined),
638 ),
639 );
640
641export const getAllCommentsQuery = (postId: string): QueryKeyReturnType[] => {
642 const sorting = Object.values(SortCommentsBy).map((sortBy) =>

Callers 3

usePostCommentsFunction · 0.90
CompanionDiscussionFunction · 0.90
getAllCommentsQueryFunction · 0.85

Calls 1

generateQueryKeyFunction · 0.85

Tested by

no test coverage detected