@@ -38,17 +38,21 @@ export function useEngine() {
3838 const currentActive = activeArtifactRef . current ;
3939 if ( currentActive && currentActive !== label ) {
4040 const j = artifacts . findIndex ( a => a . label === currentActive ) ;
41- if ( j >= 0 && artifacts [ j ] . status !== 'done' ) artifacts [ j ] = { ...artifacts [ j ] , status : 'downloading' } ;
41+ if ( j >= 0 ) {
42+ const cur = artifacts [ j ] ! ;
43+ if ( cur . status !== 'done' ) artifacts [ j ] = { label : cur . label , status : 'downloading' } ;
44+ }
4245 }
4346 if ( idx === - 1 ) {
4447 artifacts . push ( { label, status : 'downloading' } ) ;
45- } else if ( artifacts [ idx ] . status === 'pending' ) {
46- artifacts [ idx ] = { ...artifacts [ idx ] , status : 'downloading' } ;
48+ } else {
49+ const cur = artifacts [ idx ] ! ;
50+ if ( cur . status === 'pending' ) artifacts [ idx ] = { label : cur . label , status : 'downloading' } ;
4751 }
4852 activeArtifactRef . current = label ;
4953 }
5054 if ( pct >= 100 ) {
51- artifacts = artifacts . map ( a => ( { ... a , status : 'done' } ) ) ;
55+ artifacts = artifacts . map ( a => ( { label : a . label , status : 'done' } ) ) ;
5256 activeArtifactRef . current = null ;
5357 }
5458 return { pct, phase, artifacts } ;
@@ -67,7 +71,7 @@ export function useEngine() {
6771 const unload = useCallback ( ( ) => {
6872 engineRef . current = null ;
6973 setState ( 'idle' ) ;
70- setProgress ( { pct : 0 , phase : '' } ) ;
74+ setProgress ( { pct : 0 , phase : '' , artifacts : [ ] } ) ;
7175 } , [ ] ) ;
7276
7377 const clearCaches = useCallback ( async ( ) => {
0 commit comments