@@ -141,6 +141,7 @@ describe('useMutableSource', () => {
141141
142142 beforeEach ( loadModules ) ;
143143
144+ // @gate enableUseMutableSource
144145 it ( 'should subscribe to a source and schedule updates when it changes' , ( ) => {
145146 const source = createSource ( 'one' ) ;
146147 const mutableSource = createMutableSource ( source , param => param . version ) ;
@@ -208,6 +209,7 @@ describe('useMutableSource', () => {
208209 } ) ;
209210 } ) ;
210211
212+ // @gate enableUseMutableSource
211213 it ( 'should restart work if a new source is mutated during render' , ( ) => {
212214 const source = createSource ( 'one' ) ;
213215 const mutableSource = createMutableSource ( source , param => param . version ) ;
@@ -263,6 +265,7 @@ describe('useMutableSource', () => {
263265 } ) ;
264266 } ) ;
265267
268+ // @gate enableUseMutableSource
266269 it ( 'should schedule an update if a new source is mutated between render and commit (subscription)' , ( ) => {
267270 const source = createSource ( 'one' ) ;
268271 const mutableSource = createMutableSource ( source , param => param . version ) ;
@@ -302,6 +305,7 @@ describe('useMutableSource', () => {
302305 } ) ;
303306 } ) ;
304307
308+ // @gate enableUseMutableSource
305309 it ( 'should unsubscribe and resubscribe if a new source is used' , ( ) => {
306310 const sourceA = createSource ( 'a-one' ) ;
307311 const mutableSourceA = createMutableSource (
@@ -358,6 +362,7 @@ describe('useMutableSource', () => {
358362 } ) ;
359363 } ) ;
360364
365+ // @gate enableUseMutableSource
361366 it ( 'should unsubscribe and resubscribe if a new subscribe function is provided' , ( ) => {
362367 const source = createSource ( 'a-one' ) ;
363368 const mutableSource = createMutableSource ( source , param => param . version ) ;
@@ -422,6 +427,7 @@ describe('useMutableSource', () => {
422427 } ) ;
423428 } ) ;
424429
430+ // @gate enableUseMutableSource
425431 it ( 'should re-use previously read snapshot value when reading is unsafe' , ( ) => {
426432 const source = createSource ( 'one' ) ;
427433 const mutableSource = createMutableSource ( source , param => param . version ) ;
@@ -484,6 +490,7 @@ describe('useMutableSource', () => {
484490 } ) ;
485491 } ) ;
486492
493+ // @gate enableUseMutableSource
487494 it ( 'should read from source on newly mounted subtree if no pending updates are scheduled for source' , ( ) => {
488495 const source = createSource ( 'one' ) ;
489496 const mutableSource = createMutableSource ( source , param => param . version ) ;
@@ -523,6 +530,7 @@ describe('useMutableSource', () => {
523530 } ) ;
524531 } ) ;
525532
533+ // @gate enableUseMutableSource
526534 it ( 'should throw and restart render if source and snapshot are unavailable during an update' , ( ) => {
527535 const source = createSource ( 'one' ) ;
528536 const mutableSource = createMutableSource ( source , param => param . version ) ;
@@ -586,6 +594,7 @@ describe('useMutableSource', () => {
586594 } ) ;
587595 } ) ;
588596
597+ // @gate enableUseMutableSource
589598 it ( 'should throw and restart render if source and snapshot are unavailable during a sync update' , ( ) => {
590599 const source = createSource ( 'one' ) ;
591600 const mutableSource = createMutableSource ( source , param => param . version ) ;
@@ -649,6 +658,7 @@ describe('useMutableSource', () => {
649658 } ) ;
650659 } ) ;
651660
661+ // @gate enableUseMutableSource
652662 it ( 'should only update components whose subscriptions fire' , ( ) => {
653663 const source = createComplexSource ( 'a:one' , 'b:one' ) ;
654664 const mutableSource = createMutableSource ( source , param => param . version ) ;
@@ -687,6 +697,7 @@ describe('useMutableSource', () => {
687697 } ) ;
688698 } ) ;
689699
700+ // @gate enableUseMutableSource
690701 it ( 'should detect tearing in part of the store not yet subscribed to' , ( ) => {
691702 const source = createComplexSource ( 'a:one' , 'b:one' ) ;
692703 const mutableSource = createMutableSource ( source , param => param . version ) ;
@@ -779,6 +790,7 @@ describe('useMutableSource', () => {
779790 } ) ;
780791 } ) ;
781792
793+ // @gate enableUseMutableSource
782794 it ( 'does not schedule an update for subscriptions that fire with an unchanged snapshot' , ( ) => {
783795 const MockComponent = jest . fn ( Component ) ;
784796
@@ -805,6 +817,7 @@ describe('useMutableSource', () => {
805817 } ) ;
806818 } ) ;
807819
820+ // @gate enableUseMutableSource
808821 it ( 'should throw and restart if getSnapshot changes between scheduled update and re-render' , ( ) => {
809822 const source = createSource ( 'one' ) ;
810823 const mutableSource = createMutableSource ( source , param => param . version ) ;
@@ -845,6 +858,7 @@ describe('useMutableSource', () => {
845858 } ) ;
846859 } ) ;
847860
861+ // @gate enableUseMutableSource
848862 it ( 'should recover from a mutation during yield when other work is scheduled' , ( ) => {
849863 const source = createSource ( 'one' ) ;
850864 const mutableSource = createMutableSource ( source , param => param . version ) ;
@@ -899,6 +913,7 @@ describe('useMutableSource', () => {
899913 } ) ;
900914 } ) ;
901915
916+ // @gate enableUseMutableSource
902917 it ( 'should not throw if the new getSnapshot returns the same snapshot value' , ( ) => {
903918 const source = createSource ( 'one' ) ;
904919 const mutableSource = createMutableSource ( source , param => param . version ) ;
@@ -953,6 +968,7 @@ describe('useMutableSource', () => {
953968 } ) ;
954969 } ) ;
955970
971+ // @gate enableUseMutableSource
956972 it ( 'should not throw if getSnapshot changes but the source can be safely read from anyway' , ( ) => {
957973 const source = createSource ( 'one' ) ;
958974 const mutableSource = createMutableSource ( source , param => param . version ) ;
@@ -992,6 +1008,7 @@ describe('useMutableSource', () => {
9921008 } ) ;
9931009 } ) ;
9941010
1011+ // @gate enableUseMutableSource
9951012 it ( 'should still schedule an update if an eager selector throws after a mutation' , ( ) => {
9961013 const source = createSource ( {
9971014 friends : [
@@ -1058,6 +1075,7 @@ describe('useMutableSource', () => {
10581075 } ) ;
10591076 } ) ;
10601077
1078+ // @gate enableUseMutableSource
10611079 it ( 'should not warn about updates that fire between unmount and passive unsubscribe' , ( ) => {
10621080 const source = createSource ( 'one' ) ;
10631081 const mutableSource = createMutableSource ( source , param => param . version ) ;
@@ -1094,6 +1112,7 @@ describe('useMutableSource', () => {
10941112 } ) ;
10951113 } ) ;
10961114
1115+ // @gate enableUseMutableSource
10971116 it ( 'should support inline selectors and updates that are processed after selector change' , async ( ) => {
10981117 const source = createSource ( {
10991118 a : 'initial' ,
@@ -1138,6 +1157,7 @@ describe('useMutableSource', () => {
11381157 expect ( root ) . toMatchRenderedOutput ( 'Another update' ) ;
11391158 } ) ;
11401159
1160+ // @gate enableUseMutableSource
11411161 it ( 'should clear the update queue when getSnapshot changes with pending lower priority updates' , async ( ) => {
11421162 const source = createSource ( {
11431163 a : 'initial' ,
@@ -1194,6 +1214,7 @@ describe('useMutableSource', () => {
11941214 expect ( root ) . toMatchRenderedOutput ( 'B: Update' ) ;
11951215 } ) ;
11961216
1217+ // @gate enableUseMutableSource
11971218 it ( 'should clear the update queue when source changes with pending lower priority updates' , async ( ) => {
11981219 const sourceA = createSource ( 'initial' ) ;
11991220 const sourceB = createSource ( 'initial' ) ;
@@ -1238,6 +1259,7 @@ describe('useMutableSource', () => {
12381259 expect ( root ) . toMatchRenderedOutput ( 'B: Update' ) ;
12391260 } ) ;
12401261
1262+ // @gate enableUseMutableSource
12411263 it ( 'should always treat reading as potentially unsafe when getSnapshot changes between renders' , async ( ) => {
12421264 const source = createSource ( {
12431265 a : 'foo' ,
@@ -1327,6 +1349,7 @@ describe('useMutableSource', () => {
13271349 expect ( Scheduler ) . toHaveYielded ( [ 'x: bar, y: bar' ] ) ;
13281350 } ) ;
13291351
1352+ // @gate enableUseMutableSource
13301353 it ( 'getSnapshot changes and then source is mutated in between paint and passive effect phase' , async ( ) => {
13311354 const source = createSource ( {
13321355 a : 'foo' ,
@@ -1385,6 +1408,7 @@ describe('useMutableSource', () => {
13851408 expect ( root ) . toMatchRenderedOutput ( 'baz' ) ;
13861409 } ) ;
13871410
1411+ // @gate enableUseMutableSource
13881412 it ( 'getSnapshot changes and then source is mutated in between paint and passive effect phase, case 2' , async ( ) => {
13891413 const source = createSource ( {
13901414 a : 'a0' ,
@@ -1455,6 +1479,7 @@ describe('useMutableSource', () => {
14551479 expect ( root . getChildrenAsJSX ( ) ) . toEqual ( 'first: a1, second: a1' ) ;
14561480 } ) ;
14571481
1482+ // @gate enableUseMutableSource
14581483 it (
14591484 'if source is mutated after initial read but before subscription is set ' +
14601485 'up, should still entangle all pending mutations even if snapshot of ' +
@@ -1559,6 +1584,7 @@ describe('useMutableSource', () => {
15591584 } ,
15601585 ) ;
15611586
1587+ // @gate enableUseMutableSource
15621588 it ( 'warns about functions being used as snapshot values' , async ( ) => {
15631589 const source = createSource ( ( ) => 'a' ) ;
15641590 const mutableSource = createMutableSource ( source , param => param . version ) ;
@@ -1586,6 +1612,7 @@ describe('useMutableSource', () => {
15861612 expect ( root ) . toMatchRenderedOutput ( 'a' ) ;
15871613 } ) ;
15881614
1615+ // @gate enableUseMutableSource
15891616 it ( 'getSnapshot changes and then source is mutated during interleaved event' , async ( ) => {
15901617 const { useEffect} = React ;
15911618
@@ -1710,6 +1737,7 @@ describe('useMutableSource', () => {
17101737 } ) ;
17111738 } ) ;
17121739
1740+ // @gate enableUseMutableSource
17131741 it ( 'should not tear with newly mounted component when updates were scheduled at a lower priority' , async ( ) => {
17141742 const source = createSource ( 'one' ) ;
17151743 const mutableSource = createMutableSource ( source , param => param . version ) ;
@@ -1789,6 +1817,7 @@ describe('useMutableSource', () => {
17891817
17901818 if ( __DEV__ ) {
17911819 describe ( 'dev warnings' , ( ) => {
1820+ // @gate enableUseMutableSource
17921821 it ( 'should warn if the subscribe function does not return an unsubscribe function' , ( ) => {
17931822 const source = createSource ( 'one' ) ;
17941823 const mutableSource = createMutableSource (
@@ -1814,6 +1843,7 @@ describe('useMutableSource', () => {
18141843 ) ;
18151844 } ) ;
18161845
1846+ // @gate enableUseMutableSource
18171847 it ( 'should error if multiple renderers of the same type use a mutable source at the same time' , ( ) => {
18181848 const source = createSource ( 'one' ) ;
18191849 const mutableSource = createMutableSource (
@@ -1894,6 +1924,7 @@ describe('useMutableSource', () => {
18941924 } ) ;
18951925 } ) ;
18961926
1927+ // @gate enableUseMutableSource
18971928 it ( 'should error if multiple renderers of the same type use a mutable source at the same time with mutation between' , ( ) => {
18981929 const source = createSource ( 'one' ) ;
18991930 const mutableSource = createMutableSource (
0 commit comments