@@ -48,7 +48,10 @@ test('memo bypassed by props that change on every render names the props, their
4848 ) ;
4949
5050 const request = selectPropKindRequests ( raw ) ;
51- assert . deepEqual ( Object . values ( request ) , [ [ 'onPress' , 'style' ] ] ) ;
51+ assert . deepEqual (
52+ new Set ( Object . values ( request ) . map ( ( keys ) => keys . join ( ) ) ) ,
53+ new Set ( [ 'onPress,style' ] ) ,
54+ ) ;
5255 const [ id ] = Object . keys ( request ) ;
5356 const [ finding ] = analyzeReactProfile ( raw , {
5457 [ id ! ] : { onPress : 'function' , style : 'object' } ,
@@ -57,7 +60,7 @@ test('memo bypassed by props that change on every render names the props, their
5760 assert . equal ( finding ?. component , 'Row' ) ;
5861 assert . match (
5962 finding ?. evidence ?? '' ,
60- / o n P r e s s \( f u n c t i o n \) , s t y l e \( o b j e c t \) e v e r y r e n d e r f r o m L i s t / ,
63+ / o n P r e s s \( f u n c t i o n \) , s t y l e \( o b j e c t \) o n t h o s e u p d a t e s f r o m L i s t / ,
6164 ) ;
6265} ) ;
6366
@@ -96,7 +99,7 @@ test('renders forced only by a parent re-render point at the owner to memoize be
9699 assert . deepEqual ( kinds ( raw ) , [ 'parent-cascade ResultRow' ] ) ;
97100 assert . match (
98101 analyzeReactProfile ( raw ) . findings [ 0 ] ! . evidence ,
99- / w h e n e v e r S e a r c h r e n d e r e d a c r o s s 1 5 i n s t a n c e s / ,
102+ / w h e n S e a r c h r e n d e r e d a c r o s s 1 5 i n s t a n c e s / ,
100103 ) ;
101104} ) ;
102105
@@ -157,6 +160,89 @@ test('a state update set right after the previous commit is reported as an effec
157160 assert . ok ( kinds ( raw ) . includes ( 'effect-chain Filtered' ) ) ;
158161} ) ;
159162
163+ test ( 'a follow-up commit counts once per component however many of its instances triggered it' , ( ) => {
164+ const raw = rawProfile (
165+ {
166+ 1 : [ 'Screen' ] ,
167+ 2 : [ 'Filtered' , FUNCTION , 1 ] ,
168+ 3 : [ 'Filtered' , FUNCTION , 1 ] ,
169+ 4 : [ 'Filtered' , FUNCTION , 1 ] ,
170+ } ,
171+ repeat ( 3 , ( i ) => i ) . flatMap ( ( i ) : Array < [ number , number , number [ ] , Render [ ] ] > => [
172+ [
173+ i * 300 ,
174+ 10 ,
175+ [ 1 ] ,
176+ [
177+ [ 1 , 1 , [ 0 , null , [ 0 ] , null ] ] ,
178+ [ 2 , 2 ] ,
179+ [ 3 , 2 ] ,
180+ [ 4 , 2 ] ,
181+ ] ,
182+ ] ,
183+ [
184+ i * 300 + 12 ,
185+ 10 ,
186+ [ 2 , 3 , 4 ] ,
187+ [
188+ [ 2 , 3 , [ 0 , null , [ 0 ] , null ] ] ,
189+ [ 3 , 3 , [ 0 , null , [ 0 ] , null ] ] ,
190+ [ 4 , 3 , [ 0 , null , [ 0 ] , null ] ] ,
191+ ] ,
192+ ] ,
193+ ] ) ,
194+ ) ;
195+ const chain = analyzeReactProfile ( raw ) . findings . find (
196+ ( finding ) => finding . kind === 'effect-chain' ,
197+ ) ;
198+ assert . match (
199+ chain ?. evidence ?? '' ,
200+ / ^ 3 f o l l o w - u p c o m m i t s i t t r i g g e r e d r i g h t a f t e r r e n d e r i n g , l i k e l y s t a t e s e t i n a n e f f e c t \( 3 0 m s \) $ / ,
201+ ) ;
202+ } ) ;
203+
204+ test ( 'without inspected value kinds a memo bypass names the changed props without claiming new identities' , ( ) => {
205+ const rows = repeat ( 12 , ( i ) => 10 + i ) ;
206+ const elements : Record < number , [ string , number ?, number ?] > = { 1 : [ 'List' ] } ;
207+ for ( const id of rows ) elements [ id ] = [ 'Row' , MEMO , 1 ] ;
208+ const raw = rawProfile (
209+ elements ,
210+ repeat ( 3 , ( i ) => [
211+ i * 200 ,
212+ 30 ,
213+ [ 1 ] ,
214+ [ [ 1 , 1 , [ 0 , null , [ 0 ] , null ] ] , ...rows . map ( ( id ) : Render => [ id , 2 , [ 0 , [ 0 ] , null , null ] ] ) ] ,
215+ ] ) ,
216+ [ 'onPress' ] ,
217+ ) ;
218+ const [ finding ] = analyzeReactProfile ( raw ) . findings ;
219+ assert . equal (
220+ finding ?. evidence ,
221+ 'memo bypassed on 36/36 updates; onPress changed from List (value kinds not inspected)' ,
222+ ) ;
223+ } ) ;
224+
225+ test ( 'every large mount group in a commit is its own eager-mount finding' , ( ) => {
226+ const tiles = repeat ( 220 , ( i ) => 10 + i ) ;
227+ const rows = repeat ( 210 , ( i ) => 1000 + i ) ;
228+ const elements : Record < number , [ string , number ?, number ?] > = { 1 : [ 'Catalog' ] } ;
229+ for ( const id of tiles ) elements [ id ] = [ 'Tile' , FUNCTION , 1 ] ;
230+ for ( const id of rows ) elements [ id ] = [ 'Row' , FUNCTION , 1 ] ;
231+ const raw = rawProfile ( elements , [
232+ [
233+ 0 ,
234+ 400 ,
235+ [ 1 ] ,
236+ [
237+ [ 1 , 5 , [ 0 , null , [ 0 ] , null ] ] ,
238+ ...tiles . map ( ( id ) : Render => [ id , 1 , 1 ] ) ,
239+ ...rows . map ( ( id ) : Render => [ id , 1 , 1 ] ) ,
240+ ] ,
241+ ] ,
242+ ] ) ;
243+ assert . deepEqual ( kinds ( raw ) . sort ( ) , [ 'eager-mount Row' , 'eager-mount Tile' ] ) ;
244+ } ) ;
245+
160246test ( 'many commits from one updater in a short span are a render storm' , ( ) => {
161247 const raw = rawProfile (
162248 { 1 : [ 'Clock' ] } ,
0 commit comments