File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
packages/react-devtools-shared/src/backend/StyleX Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,29 @@ describe('Stylex plugin utils', () => {
33
33
} ) ;
34
34
} ) ;
35
35
36
+ it ( 'should gracefully handle empty values' , ( ) => {
37
+ expect ( getStyleXData ( null ) ) . toMatchInlineSnapshot ( `
38
+ Object {
39
+ "resolvedStyles": Object {},
40
+ "sources": Array [],
41
+ }
42
+ ` ) ;
43
+
44
+ expect ( getStyleXData ( undefined ) ) . toMatchInlineSnapshot ( `
45
+ Object {
46
+ "resolvedStyles": Object {},
47
+ "sources": Array [],
48
+ }
49
+ ` ) ;
50
+
51
+ expect ( getStyleXData ( '' ) ) . toMatchInlineSnapshot ( `
52
+ Object {
53
+ "resolvedStyles": Object {},
54
+ "sources": Array [],
55
+ }
56
+ ` ) ;
57
+ } ) ;
58
+
36
59
it ( 'should support simple style objects' , ( ) => {
37
60
defineStyles ( `
38
61
.foo {
Original file line number Diff line number Diff line change @@ -29,6 +29,10 @@ export function crawlData(
29
29
sources : Set < string > ,
30
30
resolvedStyles : Object ,
31
31
) : void {
32
+ if ( data == null ) {
33
+ return ;
34
+ }
35
+
32
36
if ( isArray ( data ) ) {
33
37
data . forEach ( entry => {
34
38
if ( isArray ( entry ) ) {
You can’t perform that action at this time.
0 commit comments