Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit f1a1662

Browse files
foxbrushFischer-L
authored andcommitted
5241 - [Preview] Show empty values
1 parent 5026582 commit f1a1662

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

src/components/Editor/Preview/Popup.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export class Popup extends Component<Props> {
211211
);
212212
}
213213

214-
renderSimplePreview(value: Object) {
214+
renderSimplePreview(value: any) {
215215
const { openLink } = this.props;
216216
return (
217217
<div className="preview-popup">
@@ -240,16 +240,17 @@ export class Popup extends Component<Props> {
240240
}
241241

242242
renderPreview() {
243+
// We don't have to check and
244+
// return on `false`, `""`, `0`, `undefined` etc,
245+
// these falsy simple typed value because we want to
246+
// do `renderSimplePreview` on these values below.
243247
const { value } = this.props;
244-
if (!value) {
245-
return null;
246-
}
247248

248-
if (value.class === "Function") {
249+
if (value && value.class === "Function") {
249250
return this.renderFunctionPreview();
250251
}
251252

252-
if (value.type === "object") {
253+
if (value && value.type === "object") {
253254
return <div>{this.renderObjectPreview()}</div>;
254255
}
255256

0 commit comments

Comments
 (0)