Skip to content

Commit 13be282

Browse files
authored
Merge pull request #57 from DaoDaoNoCode/fix-search-crash
Remove renderToString function and fix search crash issue
2 parents 22e5339 + 8879e9f commit 13be282

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

packages/module/src/LogViewer/LogViewerRow.tsx

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { memo, useContext } from 'react';
2-
import ReactDOMServer from 'react-dom/server';
32
import { LOGGER_LINE_NUMBER_INDEX_DELTA } from './utils/constants';
43
import { css } from '@patternfly/react-styles';
54
import styles from '@patternfly/react-styles/css/components/LogViewer/log-viewer';
@@ -51,16 +50,10 @@ export const LogViewerRow: React.FunctionComponent<LogViewerRowProps> = memo(({
5150
composedString.push(str);
5251
} else {
5352
const splitString = str.split(regEx);
54-
splitString.forEach((substr, newIndex) => {
53+
splitString.forEach((substr) => {
5554
if (substr.match(regEx)) {
5655
matchCounter += 1;
57-
composedString.push(
58-
ReactDOMServer.renderToString(
59-
<span className={css(styles.logViewerString, handleHighlight(matchCounter))} key={newIndex}>
60-
{substr}
61-
</span>
62-
)
63-
);
56+
composedString.push(`<span class="${css(styles.logViewerString, handleHighlight(matchCounter))}">${substr}</span>`);
6457
} else {
6558
composedString.push(escapeTextForHtml(substr));
6659
}

0 commit comments

Comments
 (0)