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

Function generateCommentsQueryKey

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

Source from the content-addressed store, hash-verified

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