1- import { Suspense , useMemo , useState } from 'react' ;
1+ import { Suspense , useState } from 'react' ;
22import useDebounce from '../hooks/useDebounce' ;
33import { fetchPageId } from '../services/MediaWikiAPIs' ;
44import { PageIdFetcher } from './PageIdFetcher' ;
@@ -15,9 +15,8 @@ export function PageTitleInput({
1515 const [ pageTitle , setPageTitle ] = useState ( initialPageTitle ) ;
1616 const debouncedPageTitle = useDebounce ( pageTitle . trim ( ) , 300 ) ;
1717
18- // Note: useMemo callback cannot be async (linter rule), but returning a Promise is fine.
19- // Semantically equivalent to async/await, but React wants explicit Promise return.
20- const pageIdPromise = useMemo ( ( ) => {
18+ // React Compiler auto-memoizes based on reactive dependencies (wikiUrl, debouncedPageTitle)
19+ const pageIdPromise = ( ( ) => {
2120 // guard
2221 if ( ! debouncedPageTitle ) {
2322 return Promise . resolve ( { } ) ;
@@ -29,7 +28,7 @@ export function PageTitleInput({
2928 console . error ( 'Error fetching page ID:' , error ) ;
3029 return { error : 'Error fetching page ID. Please try again.' } ;
3130 } ) ;
32- } , [ wikiUrl , debouncedPageTitle ] ) ;
31+ } ) ( ) ;
3332
3433 return (
3534 < div className = "form-group" >
0 commit comments