mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
[apps] Stablize app list updated event. (#13067)
Stablize app list updated event so that we only send 2 updates: 1 when installed apps become available, one when all directory apps are available. Previously it also updates when directory apps become available before installed apps, which cuts off installed apps.
This commit is contained in:
committed by
GitHub
Unverified
parent
695957a348
commit
392fa7de50
@@ -5332,8 +5332,14 @@ impl CodexMessageProcessor {
|
||||
),
|
||||
&config,
|
||||
);
|
||||
Self::send_app_list_updated_notification(&outgoing, merged.clone()).await;
|
||||
last_notified_apps = Some(merged);
|
||||
if Self::should_send_app_list_updated_notification(
|
||||
merged.as_slice(),
|
||||
accessible_loaded,
|
||||
all_loaded,
|
||||
) {
|
||||
Self::send_app_list_updated_notification(&outgoing, merged.clone()).await;
|
||||
last_notified_apps = Some(merged);
|
||||
}
|
||||
}
|
||||
|
||||
loop {
|
||||
@@ -5411,7 +5417,12 @@ impl CodexMessageProcessor {
|
||||
),
|
||||
&config,
|
||||
);
|
||||
if last_notified_apps.as_ref() != Some(&merged) {
|
||||
if Self::should_send_app_list_updated_notification(
|
||||
merged.as_slice(),
|
||||
accessible_loaded,
|
||||
all_loaded,
|
||||
) && last_notified_apps.as_ref() != Some(&merged)
|
||||
{
|
||||
Self::send_app_list_updated_notification(&outgoing, merged.clone()).await;
|
||||
last_notified_apps = Some(merged.clone());
|
||||
}
|
||||
@@ -5441,6 +5452,15 @@ impl CodexMessageProcessor {
|
||||
connectors::merge_connectors_with_accessible(all, accessible, all_connectors_loaded)
|
||||
}
|
||||
|
||||
fn should_send_app_list_updated_notification(
|
||||
connectors: &[AppInfo],
|
||||
accessible_loaded: bool,
|
||||
all_loaded: bool,
|
||||
) -> bool {
|
||||
connectors.iter().any(|connector| connector.is_accessible)
|
||||
|| (accessible_loaded && all_loaded)
|
||||
}
|
||||
|
||||
fn paginate_apps(
|
||||
connectors: &[AppInfo],
|
||||
start: usize,
|
||||
|
||||
Reference in New Issue
Block a user