Skip to content

Commit 837fa4d

Browse files
ashishdebnath97ZuhairAhmed-cs
authored andcommitted
fix: updates
1 parent e9d11d6 commit 837fa4d

2 files changed

Lines changed: 5 additions & 12 deletions

File tree

src/visualBuilder/components/Collab/ThreadPopup/CommentResolvedText.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
/** @jsxImportSource preact */
22
import { useMemo } from "preact/hooks";
33
import { ICommentResolvedText } from "../../../types/collab.types";
4-
import {
5-
getMessageWithDisplayName,
6-
sanitizeData,
7-
} from "../../../utils/collabUtils";
4+
import { getMessageWithDisplayName } from "../../../utils/collabUtils";
85
import { collabStyles } from "../../../collab.style";
96
import classNames from "classnames";
107

118
const CommentResolvedText = ({ comment, userState }: ICommentResolvedText) => {
12-
const text = useMemo(() => {
13-
return getMessageWithDisplayName(comment, userState, "html");
14-
}, [comment.message, userState.userMap, comment.toUsers]);
15-
169
const sanitizedText = useMemo(() => {
17-
return sanitizeData(text);
18-
}, [text]);
10+
return getMessageWithDisplayName(comment, userState, "html") ?? "";
11+
}, [comment.message, userState.userMap, comment.toUsers]);
1912

2013
return (
2114
<div

src/visualBuilder/utils/collabUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export const getMessageWithDisplayName = (
8787
): string | undefined => {
8888
if (!comment) return undefined;
8989

90-
let tempText = comment.message.replace(/<[^>]*>/g, "");
90+
let tempText = sanitizeData(comment.message).replace(/<[^>]*>/g, "");
9191

9292
comment?.toUsers?.forEach((user) => {
9393
const userPattern = new RegExp(`{{${user}}}`, "g");
@@ -117,7 +117,7 @@ export const sanitizeData = (dirty: any): string => {
117117
* @returns {Object} The comment body containing the sanitized message and mentioned users.
118118
*/
119119
export const getCommentBody = (state: ICommentState): ICommentState => {
120-
let finalMessage = state.message
120+
let finalMessage = sanitizeData(state.message)
121121
.replace(/[^\S\r\n]+/g, " ")
122122
.replace(/ *\n */g, "\n")
123123
.replace(/<[^>]*>/g, "")

0 commit comments

Comments
 (0)