@@ -104,11 +104,7 @@ export async function handleMarketplaceMessages(
104104 case "fetchMarketplaceItems" : {
105105 // Prevent multiple simultaneous fetches
106106 if ( marketplaceManager . isFetching ) {
107- await provider . postMessageToWebview ( {
108- type : "state" ,
109- text : "Fetch already in progress" ,
110- } )
111- marketplaceManager . isFetching = false
107+ console . warn ( "Fetch already in progress" )
112108 return true
113109 }
114110
@@ -149,41 +145,29 @@ export async function handleMarketplaceMessages(
149145 else if ( result . errors && result . items . length === 0 ) {
150146 const errorMessage = `Failed to load marketplace sources:\n${ result . errors . join ( "\n" ) } `
151147 vscode . window . showErrorMessage ( errorMessage )
152- await provider . postMessageToWebview ( {
153- type : "state" ,
154- text : errorMessage ,
155- } )
156- marketplaceManager . isFetching = false
157148 }
158149
159150 // The items are already stored in MarketplaceManager's currentItems
160151 // No need to store in global state
161152
162- // Send state to webview
153+ // Is done, send state to webview
154+ marketplaceManager . isFetching = false
163155 await provider . postStateToWebview ( )
164156
165157 return true
166158 } catch ( initError ) {
167159 const errorMessage = `Marketplace initialization failed: ${ initError instanceof Error ? initError . message : String ( initError ) } `
168160 console . error ( "Error in marketplace initialization:" , initError )
169- vscode . window . showErrorMessage ( errorMessage )
170- await provider . postMessageToWebview ( {
171- type : "state" ,
172- text : errorMessage ,
173- } )
174161 // The state will already be updated with empty items by MarketplaceManager
175- await provider . postStateToWebview ( )
162+ vscode . window . showErrorMessage ( errorMessage )
176163 marketplaceManager . isFetching = false
164+ await provider . postStateToWebview ( )
177165 return false
178166 }
179167 } catch ( error ) {
180168 const errorMessage = `Failed to fetch marketplace items: ${ error instanceof Error ? error . message : String ( error ) } `
181169 console . error ( "Failed to fetch marketplace items:" , error )
182170 vscode . window . showErrorMessage ( errorMessage )
183- await provider . postMessageToWebview ( {
184- type : "state" ,
185- text : errorMessage ,
186- } )
187171 marketplaceManager . isFetching = false
188172 return false
189173 }
0 commit comments