Skip to content

Commit b192b4f

Browse files
committed
fix[react-devtools/store-test]: fork the test to represent current behavior
1 parent 704aeed commit b192b4f

1 file changed

Lines changed: 32 additions & 2 deletions

File tree

packages/react-devtools-shared/src/__tests__/store-test.js

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1915,8 +1915,13 @@ describe('Store', () => {
19151915
});
19161916
});
19171917

1918-
// @reactVersion >= 18.0
1919-
it('from react get counted', () => {
1918+
1919+
// In React 19, JSX warnings were moved into the renderer - https://github.com/facebook/react/pull/29088
1920+
// When the error is emitted, the source fiber of this error is not yet mounted
1921+
// So DevTools can't connect the error and the fiber
1922+
// TODO(hoxyq): update RDT to keep track of such fibers
1923+
// @reactVersion >= 19.0
1924+
it('from react get counted [React >= 19]', () => {
19201925
function Example() {
19211926
return [<Child />];
19221927
}
@@ -1938,6 +1943,31 @@ describe('Store', () => {
19381943
`);
19391944
});
19401945

1946+
// @reactVersion >= 18.0
1947+
// @reactVersion < 19.0
1948+
it('from react get counted [React 18.x]', () => {
1949+
function Example() {
1950+
return [<Child />];
1951+
}
1952+
function Child() {
1953+
return null;
1954+
}
1955+
1956+
withErrorsOrWarningsIgnored(
1957+
['Warning: Each child in a list should have a unique "key" prop'],
1958+
() => {
1959+
act(() => render(<Example />));
1960+
},
1961+
);
1962+
1963+
expect(store).toMatchInlineSnapshot(`
1964+
✕ 1, ⚠ 0
1965+
[root]
1966+
▾ <Example> ✕
1967+
<Child>
1968+
`);
1969+
});
1970+
19411971
// @reactVersion >= 18.0
19421972
it('can be cleared for the whole app', () => {
19431973
function Example() {

0 commit comments

Comments
 (0)