Skip to content

Commit 08fce62

Browse files
authored
Gracefully handle empty "xstyle" prop values (Part 2) (#23279)
#23190 misses if entry is undefined or null. This fixes this issue.
1 parent 1fb0d06 commit 08fce62

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

packages/react-devtools-shared/src/backend/StyleX/__tests__/utils-test.js

+7
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ describe('Stylex plugin utils', () => {
5454
"sources": Array [],
5555
}
5656
`);
57+
58+
expect(getStyleXData([undefined])).toMatchInlineSnapshot(`
59+
Object {
60+
"resolvedStyles": Object {},
61+
"sources": Array [],
62+
}
63+
`);
5764
});
5865

5966
it('should support simple style objects', () => {

packages/react-devtools-shared/src/backend/StyleX/utils.js

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ export function crawlData(
3535

3636
if (isArray(data)) {
3737
data.forEach(entry => {
38+
if (entry == null) {
39+
return;
40+
}
41+
3842
if (isArray(entry)) {
3943
crawlData(entry, sources, resolvedStyles);
4044
} else {

0 commit comments

Comments
 (0)