Skip to content

Commit fa9c43d

Browse files
committed
Fix preview error
1 parent d86f098 commit fa9c43d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/CodeSnippetDisplay.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ export class CodeSnippetDisplay extends React.Component<
328328
while (nextIndex !== null) {
329329
// make the current index bold
330330
elements.push(
331-
<mark className={SEARCH_BOLD}>
331+
<mark key={id + '_' + currIndex} className={SEARCH_BOLD}>
332332
{displayName.substring(currIndex, currIndex + 1)}
333333
</mark>
334334
);
@@ -342,10 +342,9 @@ export class CodeSnippetDisplay extends React.Component<
342342
nextIndex = null;
343343
}
344344
}
345-
// key={id+'_'+currIndex}
346345
if (nextIndex === null) {
347346
elements.push(
348-
<mark className={SEARCH_BOLD}>
347+
<mark key={id + '_' + currIndex} className={SEARCH_BOLD}>
349348
{displayName.substring(currIndex, currIndex + 1)}
350349
</mark>
351350
);
@@ -1492,8 +1491,8 @@ export class CodeSnippetDisplay extends React.Component<
14921491
/>
14931492
<div className={CODE_SNIPPETS_CONTAINER}>
14941493
<div>
1495-
{this.state.codeSnippets.map(codeSnippet =>
1496-
this.renderCodeSnippet(codeSnippet, codeSnippet.id)
1494+
{this.state.codeSnippets.map((codeSnippet, id) =>
1495+
this.renderCodeSnippet(codeSnippet, id)
14971496
)}
14981497
</div>
14991498
</div>

0 commit comments

Comments
 (0)