File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed
react-reconciler/src/__tests__ Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,43 @@ describe('ReactBlocks', () => {
49
49
} ;
50
50
} ) ;
51
51
52
+ it . experimental ( 'prints the name of the render function in warnings' , ( ) => {
53
+ function Query ( firstName ) {
54
+ return {
55
+ name : firstName ,
56
+ } ;
57
+ }
58
+
59
+ function User ( props , data ) {
60
+ let array = [ < span > { data . name } </ span > ] ;
61
+ return < div > { array } </ div > ;
62
+ }
63
+
64
+ function App ( { Component} ) {
65
+ return (
66
+ < Suspense fallback = { 'Loading...' } >
67
+ < Component name = "Name" />
68
+ </ Suspense >
69
+ ) ;
70
+ }
71
+
72
+ let loadUser = block ( Query , User ) ;
73
+
74
+ expect ( ( ) => {
75
+ ReactNoop . act ( ( ) => {
76
+ ReactNoop . render ( < App Component = { loadUser ( ) } /> ) ;
77
+ } ) ;
78
+ } ) . toErrorDev (
79
+ 'Warning: Each child in a list should have a unique ' +
80
+ '"key" prop.\n\nCheck the render method of `User`. See ' +
81
+ 'https://fb.me/react-warning-keys for more information.\n' +
82
+ ' in span (at **)\n' +
83
+ ' in User (at **)\n' +
84
+ ' in Suspense (at **)\n' +
85
+ ' in App (at **)' ,
86
+ ) ;
87
+ } ) ;
88
+
52
89
it . experimental ( 'renders a component with a suspending query' , async ( ) => {
53
90
function Query ( id ) {
54
91
return {
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ function getComponentName(type: mixed): string | null {
87
87
case REACT_MEMO_TYPE :
88
88
return getComponentName ( type . type ) ;
89
89
case REACT_BLOCK_TYPE :
90
- return getComponentName ( type . render ) ;
90
+ return getComponentName ( type . _render ) ;
91
91
case REACT_LAZY_TYPE : {
92
92
const lazyComponent : LazyComponent < any , any > = ( type : any ) ;
93
93
let payload = lazyComponent . _payload ;
You can’t perform that action at this time.
0 commit comments