perf(renderer): skip idle reply candidate scans
This commit is contained in:
parent
5041c79916
commit
4d0f3d802b
1 changed files with 23 additions and 11 deletions
|
|
@ -100,6 +100,7 @@ const OPENCODE_RUNTIME_DELIVERY_STATUS_REFRESH_DELAYS_MS = [15_000, 45_000, 90_0
|
||||||
const MESSAGES_SCROLL_TOP_PERSIST_DELAY_MS = 100;
|
const MESSAGES_SCROLL_TOP_PERSIST_DELAY_MS = 100;
|
||||||
const EMPTY_TEAM_NAMES: string[] = [];
|
const EMPTY_TEAM_NAMES: string[] = [];
|
||||||
const EMPTY_TEAM_COLOR_MAP = new Map<string, string>();
|
const EMPTY_TEAM_COLOR_MAP = new Map<string, string>();
|
||||||
|
const EMPTY_REPLY_CANDIDATE_MESSAGES: InboxMessage[] = [];
|
||||||
|
|
||||||
interface TeamMentionMeta {
|
interface TeamMentionMeta {
|
||||||
teamNames: string[];
|
teamNames: string[];
|
||||||
|
|
@ -691,17 +692,23 @@ export const MessagesPanel = memo(function MessagesPanel({
|
||||||
});
|
});
|
||||||
}, [effectiveMessages, leadNames, messagesFilter, messagesSearchQuery, timeWindow]);
|
}, [effectiveMessages, leadNames, messagesFilter, messagesSearchQuery, timeWindow]);
|
||||||
|
|
||||||
|
const hasTrackedPendingReplies = useMemo(
|
||||||
|
() => Object.keys(pendingRepliesByMember).length > 0,
|
||||||
|
[pendingRepliesByMember]
|
||||||
|
);
|
||||||
const replyCandidateMessages = useMemo(
|
const replyCandidateMessages = useMemo(
|
||||||
() =>
|
() =>
|
||||||
effectiveMessages.filter(
|
hasTrackedPendingReplies
|
||||||
(m) =>
|
? effectiveMessages.filter(
|
||||||
m.messageKind !== 'task_comment_notification' &&
|
(m) =>
|
||||||
!isTaskStallRemediationMessage(m) &&
|
m.messageKind !== 'task_comment_notification' &&
|
||||||
!isMemberWorkSyncNudgeMessage(m) &&
|
!isTaskStallRemediationMessage(m) &&
|
||||||
!isReviewPickupEscalationMessage(m) &&
|
!isMemberWorkSyncNudgeMessage(m) &&
|
||||||
!shouldExcludeInboxTextFromReplyCandidates(typeof m.text === 'string' ? m.text : '')
|
!isReviewPickupEscalationMessage(m) &&
|
||||||
),
|
!shouldExcludeInboxTextFromReplyCandidates(typeof m.text === 'string' ? m.text : '')
|
||||||
[effectiveMessages]
|
)
|
||||||
|
: EMPTY_REPLY_CANDIDATE_MESSAGES,
|
||||||
|
[effectiveMessages, hasTrackedPendingReplies]
|
||||||
);
|
);
|
||||||
const sendMessageRuntimeReplyVisible = useMemo(
|
const sendMessageRuntimeReplyVisible = useMemo(
|
||||||
() => hasVisibleReplyForSendMessageDiagnostics(sendMessageDebugDetails, effectiveMessages),
|
() => hasVisibleReplyForSendMessageDiagnostics(sendMessageDebugDetails, effectiveMessages),
|
||||||
|
|
@ -840,10 +847,15 @@ export const MessagesPanel = memo(function MessagesPanel({
|
||||||
|
|
||||||
// Auto-clear pending replies when a member actually responds
|
// Auto-clear pending replies when a member actually responds
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (Object.keys(pendingRepliesByMember).length === 0) return;
|
if (!hasTrackedPendingReplies) return;
|
||||||
const next = reconcilePendingRepliesByMember(pendingRepliesByMember, replyCandidateMessages);
|
const next = reconcilePendingRepliesByMember(pendingRepliesByMember, replyCandidateMessages);
|
||||||
if (next !== pendingRepliesByMember) onPendingReplyChange(() => next);
|
if (next !== pendingRepliesByMember) onPendingReplyChange(() => next);
|
||||||
}, [onPendingReplyChange, pendingRepliesByMember, replyCandidateMessages]);
|
}, [
|
||||||
|
hasTrackedPendingReplies,
|
||||||
|
onPendingReplyChange,
|
||||||
|
pendingRepliesByMember,
|
||||||
|
replyCandidateMessages,
|
||||||
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!sendMessageRuntimeReplyVisible || !sendMessageDebugDetails?.messageId) return;
|
if (!sendMessageRuntimeReplyVisible || !sendMessageDebugDetails?.messageId) return;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue