GeezerVison is showing github.com — fix[react-devtools/store-test]: fork the test to represent current be… · hanzoai/react@852672f
File tree
Expand file treeCollapse file tree
Open diff view settings
packages/react-devtools-shared/src/__tests__
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/react-devtools-shared/src/__tests__/store-test.js +31-2Lines changed: 31 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1915,8 +1915,12 @@ describe('Store', () => { |
1915 | 1915 | }); |
1916 | 1916 | }); |
1917 | 1917 |
|
1918 | | - // @reactVersion >= 18.0 |
1919 | | - it('from react get counted', () => { |
| 1918 | + // In React 19, JSX warnings were moved into the renderer - https://github.com/facebook/react/pull/29088 |
| 1919 | + // When the error is emitted, the source fiber of this error is not yet mounted |
| 1920 | + // So DevTools can't connect the error and the fiber |
| 1921 | + // TODO(hoxyq): update RDT to keep track of such fibers |
| 1922 | + // @reactVersion >= 19.0 |
| 1923 | + it('from react get counted [React >= 19]', () => { |
1920 | 1924 | function Example() { |
1921 | 1925 | return [<Child />]; |
1922 | 1926 | } |
@@ -1938,6 +1942,31 @@ describe('Store', () => { |
1938 | 1942 | `); |
1939 | 1943 | }); |
1940 | 1944 |
|
| 1945 | + // @reactVersion >= 18.0 |
| 1946 | + // @reactVersion < 19.0 |
| 1947 | + it('from react get counted [React 18.x]', () => { |
| 1948 | + function Example() { |
| 1949 | + return [<Child />]; |
| 1950 | + } |
| 1951 | + function Child() { |
| 1952 | + return null; |
| 1953 | + } |
| 1954 | + |
| 1955 | + withErrorsOrWarningsIgnored( |
| 1956 | + ['Warning: Each child in a list should have a unique "key" prop'], |
| 1957 | + () => { |
| 1958 | + act(() => render(<Example />)); |
| 1959 | + }, |
| 1960 | + ); |
| 1961 | + |
| 1962 | + expect(store).toMatchInlineSnapshot(` |
| 1963 | + ✕ 1, ⚠ 0 |
| 1964 | + [root] |
| 1965 | + ▾ <Example> ✕ |
| 1966 | + <Child> |
| 1967 | + `); |
| 1968 | + }); |
| 1969 | + |
1941 | 1970 | // @reactVersion >= 18.0 |
1942 | 1971 | it('can be cleared for the whole app', () => { |
1943 | 1972 | function Example() { |
|