@@ -1977,16 +1977,18 @@ describe('ReactHooksWithNoopRenderer', () => {
19771977 it . experimental (
19781978 'delays showing loading state until after timeout' ,
19791979 async ( ) => {
1980+ const SUSPENSE_CONFIG = {
1981+ timeoutMs : 1000 ,
1982+ } ;
1983+
19801984 let transition ;
19811985 function App ( ) {
19821986 const [ show , setShow ] = useState ( false ) ;
1983- const [ startTransition , isPending ] = useTransition ( {
1984- timeoutMs : 1000 ,
1985- } ) ;
1987+ const [ startTransition , isPending ] = useTransition ( ) ;
19861988 transition = ( ) => {
19871989 startTransition ( ( ) => {
19881990 setShow ( true ) ;
1989- } ) ;
1991+ } , SUSPENSE_CONFIG ) ;
19901992 } ;
19911993 return (
19921994 < Suspense
@@ -2043,17 +2045,19 @@ describe('ReactHooksWithNoopRenderer', () => {
20432045 it . experimental (
20442046 'delays showing loading state until after busyDelayMs + busyMinDurationMs' ,
20452047 async ( ) => {
2048+ const SUSPENSE_CONFIG = {
2049+ busyDelayMs : 1000 ,
2050+ busyMinDurationMs : 2000 ,
2051+ } ;
2052+
20462053 let transition ;
20472054 function App ( ) {
20482055 const [ show , setShow ] = useState ( false ) ;
2049- const [ startTransition , isPending ] = useTransition ( {
2050- busyDelayMs : 1000 ,
2051- busyMinDurationMs : 2000 ,
2052- } ) ;
2056+ const [ startTransition , isPending ] = useTransition ( ) ;
20532057 transition = ( ) => {
20542058 startTransition ( ( ) => {
20552059 setShow ( true ) ;
2056- } ) ;
2060+ } , SUSPENSE_CONFIG ) ;
20572061 } ;
20582062 return (
20592063 < Suspense
@@ -2113,13 +2117,15 @@ describe('ReactHooksWithNoopRenderer', () => {
21132117 ) ;
21142118
21152119 it . experimental ( 'always returns the same startTransition' , async ( ) => {
2120+ const SUSPENSE_CONFIG = {
2121+ busyDelayMs : 1000 ,
2122+ busyMinDurationMs : 2000 ,
2123+ } ;
2124+
21162125 let transition ;
21172126 function App ( ) {
21182127 const [ step , setStep ] = useState ( 0 ) ;
2119- const [ startTransition , isPending ] = useTransition ( {
2120- busyDelayMs : 1000 ,
2121- busyMinDurationMs : 2000 ,
2122- } ) ;
2128+ const [ startTransition , isPending ] = useTransition ( ) ;
21232129 // Log whenever startTransition changes
21242130 useEffect (
21252131 ( ) => {
@@ -2130,7 +2136,7 @@ describe('ReactHooksWithNoopRenderer', () => {
21302136 transition = ( ) => {
21312137 startTransition ( ( ) => {
21322138 setStep ( n => n + 1 ) ;
2133- } ) ;
2139+ } , SUSPENSE_CONFIG ) ;
21342140 } ;
21352141 return (
21362142 < Suspense fallback = { < Text text = "Loading..." /> } >
@@ -2175,12 +2181,12 @@ describe('ReactHooksWithNoopRenderer', () => {
21752181 } ) ;
21762182
21772183 it . experimental (
2178- 'can update suspense config (without changing startTransition) ' ,
2184+ 'can pass different suspense configs per transition ' ,
21792185 async ( ) => {
21802186 let transition ;
21812187 function App ( { timeoutMs} ) {
21822188 const [ step , setStep ] = useState ( 0 ) ;
2183- const [ startTransition , isPending ] = useTransition ( { timeoutMs } ) ;
2189+ const [ startTransition , isPending ] = useTransition ( ) ;
21842190 // Log whenever startTransition changes
21852191 useEffect (
21862192 ( ) => {
@@ -2189,9 +2195,12 @@ describe('ReactHooksWithNoopRenderer', () => {
21892195 [ startTransition ] ,
21902196 ) ;
21912197 transition = ( ) => {
2192- startTransition ( ( ) => {
2193- setStep ( n => n + 1 ) ;
2194- } ) ;
2198+ startTransition (
2199+ ( ) => {
2200+ setStep ( n => n + 1 ) ;
2201+ } ,
2202+ { timeoutMs} ,
2203+ ) ;
21952204 } ;
21962205 return (
21972206 < Suspense fallback = { < Text text = "Loading..." /> } >
0 commit comments