Skip to content

Honor globalState cache in getAssignable/MentionableUsers when a fetch is already in flight#8715

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-cache-bypass-in-user-fetch
Draft

Honor globalState cache in getAssignable/MentionableUsers when a fetch is already in flight#8715
Copilot wants to merge 2 commits intomainfrom
copilot/fix-cache-bypass-in-user-fetch

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 28, 2026

getAssignableUsers() and getMentionableUsers() in folderRepositoryManager.ts returned globalStateCache ?? fetchPromise on the first call, but on subsequent calls (when _fetchPromise already existed from a prior invocation) they returned the pending promise directly, bypassing the disk cache and forcing the UI to block on the network — most noticeably after getAssignableUsers(true) clears the in-memory cache while a fetch is still in flight.

Changes

  • src/github/folderRepositoryManager.ts: align the fallback return on the "fetch already in progress" path with the first-call path so both methods consistently prefer the globalState cache:
-    return this._fetchMentionableUsersPromise;
+    return globalStateMentionableUsers ?? this._fetchMentionableUsersPromise;
-    return this._fetchAssignableUsersPromise;
+    return globalStateAssignableUsers ?? this._fetchAssignableUsersPromise;

globalStateMentionableUsers / globalStateAssignableUsers are already loaded immediately above each return, so this is a pure correctness fix with no extra I/O. Background refresh behavior is unchanged — concurrent callers now get the cached value instantly while the existing fetch promise continues to update the in-memory and globalState caches when it resolves.

Copilot AI changed the title [WIP] Fix cache bypass bug in getAssignableUsers and getMentionableUsers Honor globalState cache in getAssignable/MentionableUsers when a fetch is already in flight Apr 28, 2026
Copilot AI requested a review from alexr00 April 28, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getAssignableUsers and getMentionableUsers bypass globalState cache when fetch promise already exists

2 participants