@samitouri / QOS-React-2 / commits / 69b2ecc531

Added explicit (empty) label next to empty arrays and objects

Brian Vaughn committed Aug 16, 2019 at 13:47 UTC 69b2ecc531f24f6e0e0dbbb26844b060d581926b
3 files changed +14 -2
shells/dev/app/InspectableElements/NestedProps.js
+2
@@ -46,6 +46,8 @@ export default function ObjectProps() {
46 },
47 },
48 }}
49 + emptyArray={[]}
50 + emptyObject={{}}
51 />
52 );
53 }
src/devtools/views/Components/KeyValue.css
+4
@@ -35,3 +35,7 @@
35 flex: 0 0 1rem;
36 width: 1rem;
37 }
38 +
39 +.Empty {
40 + color: var(--color-dimmer);
41 +}
src/devtools/views/Components/KeyValue.js
+8 -2
@@ -148,7 +148,10 @@ export default function KeyValue({
148 >
149 {name}
150 </span>
151 - <span>Array</span>
151 + <span>
152 + Array{' '}
153 + {hasChildren ? '' : <span className={styles.Empty}>(empty)</span>}
154 + </span>
155 </div>
156 );
157 } else {
@@ -184,7 +187,10 @@ export default function KeyValue({
187 >
188 {name}
189 </span>
187 - <span>Object</span>
190 + <span>
191 + Object{' '}
192 + {hasChildren ? '' : <span className={styles.Empty}>(empty)</span>}
193 + </span>
194 </div>
195 );
196 }