File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
src/extension/chatSessions/vscode-node Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -328,14 +328,25 @@ export class CopilotCloudSessionsProvider extends Disposable implements vscode.C
328328 }
329329 }
330330
331- async provideChatSessionItems ( token : vscode . CancellationToken ) : Promise < vscode . ChatSessionItem [ ] > {
332- // Return cached items if available
333- if ( this . cachedSessionItems ) {
331+ private async overrideWithCache ( ) : Promise < vscode . ChatSessionItem [ ] | undefined > {
332+ // Return cache only if is already being tracked
333+ if ( this . cachedSessionItems && this . activeSessionIds . size > 0 ) {
334334 return this . cachedSessionItems ;
335335 }
336336
337+ // Multiple calls should return the same promise as long as it's pending
337338 if ( this . chatSessionItemsPromise ) {
338- return this . chatSessionItemsPromise ;
339+ return await this . chatSessionItemsPromise ;
340+ }
341+
342+ // No cache, refresh
343+ return undefined ;
344+ }
345+
346+ async provideChatSessionItems ( token : vscode . CancellationToken ) : Promise < vscode . ChatSessionItem [ ] > {
347+ const cache = await this . overrideWithCache ( ) ;
348+ if ( cache ) {
349+ return cache ;
339350 }
340351 this . chatSessionItemsPromise = ( async ( ) => {
341352 const repoId = await getRepoId ( this . _gitService ) ;
You can’t perform that action at this time.
0 commit comments