File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -16,18 +16,19 @@ export function PageTitleInput({
1616 const debouncedPageTitle = useDebounce ( pageTitle . trim ( ) , 300 ) ;
1717
1818 // React Compiler auto-memoizes based on reactive dependencies (wikiUrl, debouncedPageTitle)
19- const pageIdPromise = ( ( ) => {
19+ const pageIdPromise = ( async ( ) => {
2020 // guard
2121 if ( ! debouncedPageTitle ) {
22- return Promise . resolve ( { } ) ;
22+ return { } ;
2323 }
2424 // fetch page ID
25- return fetchPageId ( wikiUrl , debouncedPageTitle )
26- . then ( ( id ) => ( { id : id . toString ( ) } ) )
27- . catch ( ( error ) => {
28- console . error ( 'Error fetching page ID:' , error ) ;
29- return { error : 'Error fetching page ID. Please try again.' } ;
30- } ) ;
25+ try {
26+ const id = await fetchPageId ( wikiUrl , debouncedPageTitle ) ;
27+ return { id : id . toString ( ) } ;
28+ } catch ( error ) {
29+ console . error ( 'Error fetching page ID:' , error ) ;
30+ return { error : 'Error fetching page ID. Please try again.' } ;
31+ }
3132 } ) ( ) ;
3233
3334 return (
You can’t perform that action at this time.
0 commit comments