@quesmed/types-rn 2.2.93 → 2.2.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -35,7 +35,7 @@ export interface IQuestionCommentsVar {
|
|
|
35
35
|
}
|
|
36
36
|
export declare type IQuestionCommentsData = RestrictedData<graphqlNormalize & IQuestionComment, 'questionComments'>;
|
|
37
37
|
export declare const QUESTION_COMMENT_LIKE: import("@apollo/client").DocumentNode;
|
|
38
|
-
export declare const optimisticCommentLike: (comments: IQuestionComment[], input: IQuestionCommentsLikeVar) => IQuestionCommentsLikeData;
|
|
38
|
+
export declare const optimisticCommentLike: (comments: IQuestionComment[], input: IQuestionCommentsLikeVar, parentId: number | null) => IQuestionCommentsLikeData;
|
|
39
39
|
export interface IQuestionCommentsLikeVar {
|
|
40
40
|
commentId: Id;
|
|
41
41
|
like: EQuestionLike;
|
|
@@ -366,15 +366,19 @@ exports.QUESTION_COMMENT_LIKE = (0, client_1.gql) `
|
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
`;
|
|
369
|
-
const optimisticCommentLike = (comments, input) => {
|
|
369
|
+
const optimisticCommentLike = (comments, input, parentId) => {
|
|
370
370
|
const { commentId, like } = input;
|
|
371
|
-
const
|
|
371
|
+
const topLevelComment = comments.find(({ id }) => Number(id) === Number(parentId || commentId)) ||
|
|
372
372
|
{};
|
|
373
|
+
const comment = parentId && topLevelComment.replies
|
|
374
|
+
? topLevelComment.replies.find(({ id }) => Number(id) === Number(commentId)) || {}
|
|
375
|
+
: topLevelComment;
|
|
373
376
|
return {
|
|
374
377
|
restricted: {
|
|
375
378
|
questionCommentLike: {
|
|
376
379
|
...comment,
|
|
377
|
-
|
|
380
|
+
replies: parentId ? [] : comment.replies,
|
|
381
|
+
id: Number(comment.id),
|
|
378
382
|
__typename: 'QuestionComment',
|
|
379
383
|
...(0, exports.getLikeData)(like, comment),
|
|
380
384
|
},
|