[apps] Fix app loading logic. (#11518)

When `app/list` is called with `force_refetch=True`, we should seed the
results with what is already cached instead of starting from an empty
list. Otherwise when we send app/list/updated events, the client will
first see an empty list of accessible apps and then get the updated one.
This commit is contained in:
Matthew Zeng authored and GitHub committed 2026-02-13 03:55:10 +00:00
1 parent 35692e99c1
commit f93037f55d
4 files changed
+296 -11

No files matched your search

+13
View File
@@ -52,6 +52,19 @@ pub async fn list_accessible_connectors_from_mcp_tools(
list_accessible_connectors_from_mcp_tools_with_options(config, false).await
}
pub async fn list_cached_accessible_connectors_from_mcp_tools(
config: &Config,
) -> Option<Vec<AppInfo>> {
if !config.features.enabled(Feature::Apps) {
return Some(Vec::new());
}
let auth_manager = auth_manager_from_config(config);
let auth = auth_manager.auth().await;
let cache_key = accessible_connectors_cache_key(config, auth.as_ref());
read_cached_accessible_connectors(&cache_key)
}
pub async fn list_accessible_connectors_from_mcp_tools_with_options(
config: &Config,
force_refetch: bool,