Avoid app crashing when code (data) is undefined (#681)
* fix: code field ui errors when data is undefined
This commit is contained in:
@@ -3,7 +3,10 @@ import React from 'react';
|
||||
import './index.scss';
|
||||
|
||||
const CodeCell = ({ data }) => {
|
||||
const textToShow = data.length > 100 ? `${data.substr(0, 100)}\u2026` : data;
|
||||
let textToShow = '';
|
||||
|
||||
if (data) textToShow = data.length > 100 ? `${data.substr(0, 100)}\u2026` : data;
|
||||
|
||||
return (
|
||||
<code className="code-cell">
|
||||
<span>{textToShow}</span>
|
||||
|
||||
Reference in New Issue
Block a user