@@ -41,6 +41,7 @@ const ComponentDetailPage: FC = () => {
4141 return ;
4242 }
4343
44+ const abortController = new AbortController ( ) ;
4445 const fetchURL = `./api/v0/web/components/${ id } ` ;
4546 setLoadingEndpoint ( fetchURL ) ;
4647
@@ -49,6 +50,7 @@ const ComponentDetailPage: FC = () => {
4950 const resp = await fetch ( fetchURL , {
5051 cache : 'no-cache' ,
5152 credentials : 'same-origin' ,
53+ signal : abortController . signal ,
5254 } ) ;
5355 const data : ComponentDetail = await resp . json ( ) ;
5456
@@ -58,6 +60,7 @@ const ComponentDetailPage: FC = () => {
5860 const moduleComponentsResp = await fetch ( modulesURL , {
5961 cache : 'no-cache' ,
6062 credentials : 'same-origin' ,
63+ signal : abortController . signal ,
6164 } ) ;
6265 const moduleComponents = ( await moduleComponentsResp . json ( ) ) as ComponentInfo [ ] ;
6366
@@ -68,7 +71,17 @@ const ComponentDetailPage: FC = () => {
6871 setLoadingEndpoint ( null ) ;
6972 } ;
7073
71- worker ( ) . catch ( console . error ) ;
74+ worker ( ) . catch ( ( err ) => {
75+ // Ignore abort errors - these are expected when the effect cleans up
76+ if ( err instanceof Error && err . name === 'AbortError' ) {
77+ return ;
78+ }
79+ console . error ( err ) ;
80+ } ) ;
81+
82+ return ( ) => {
83+ abortController . abort ( ) ;
84+ } ;
7285 } ,
7386 [ id ]
7487 ) ;
0 commit comments