Repository navigation
fix(web): hide ineffective mark unread actions during active runs #25060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7a67ac5
551ac41
3027afd
7f08805
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,7 @@ import { foldSearchQuery, rankMessageMatches } from "@t3tools/shared/paletteSear | |
| import { findForMessageMatch, openThreadFindOnQuery } from "./chat/threadFindStore"; | ||
| import { | ||
| threadRuntimeCanArchive, | ||
| threadRuntimeIsActive, | ||
| type EnvironmentThreadShell, | ||
| } from "@t3tools/client-runtime/state/models"; | ||
| import { | ||
|
|
@@ -184,7 +185,9 @@ import { | |
| groupSidebarThreadsByProject, | ||
| sidebarFolderExpansionKeys, | ||
| buildBulkTitleRegenerationContextMenuItem, | ||
| buildBulkMarkUnreadContextMenuItem, | ||
| buildBulkUnpinContextMenuItem, | ||
| canMarkThreadUnread, | ||
| deleteSelectedThreadEntries, | ||
| filterSidebarProjectScopeItems, | ||
| firstValidTimestampMs, | ||
|
|
@@ -2312,6 +2315,10 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve | |
| const unpinMenuItem = buildBulkUnpinContextMenuItem({ | ||
| pinnedCount: pinnedSelectedThreads.length, | ||
| }); | ||
| const markUnreadThreads = selectedThreads.filter(canMarkThreadUnread); | ||
| const markUnreadMenuItem = buildBulkMarkUnreadContextMenuItem({ | ||
| eligibleCount: markUnreadThreads.length, | ||
| }); | ||
| // Presets sync across environments, so the first selected thread's stand for all. | ||
| const menuOpenedAt = new Date(); | ||
| const snoozePresets = resolveSnoozePresets( | ||
|
|
@@ -2362,7 +2369,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve | |
| }, | ||
| ] | ||
| : []), | ||
| { id: "mark-unread", label: `Mark unread (${count})` }, | ||
| ...(markUnreadMenuItem ? [markUnreadMenuItem] : []), | ||
| { | ||
| id: "delete", | ||
| label: `Delete (${count})`, | ||
|
|
@@ -2472,9 +2479,8 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve | |
| return; | ||
| } | ||
| if (clicked.value === "mark-unread") { | ||
| for (const threadKey of threadKeys) { | ||
| const thread = threadByKeyRef.current.get(threadKey); | ||
| if (thread) markThreadUnread(scopeThreadRef(thread.environmentId, thread.id)); | ||
| for (const thread of markUnreadThreads) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Recheck eligibility after the menu closes. If an eligible thread starts a run while the menu is open, this loop still marks it unread and clears the selection. The action then has no visible effect during the run. Recheck the selected targets after the await and retain or report skipped targets. The individual menus have the same stale-state risk.
|
||
| markThreadUnread(scopeThreadRef(thread.environmentId, thread.id)); | ||
| } | ||
| clearSelection(); | ||
| return; | ||
|
|
@@ -2642,6 +2648,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve | |
| canSnoozeNow: canSnooze(thread, { now: new Date().toISOString() }), | ||
| isRegeneratingTitle, | ||
| isRunning: !threadRuntimeCanArchive(thread.runtime), | ||
| hasActiveRun: threadRuntimeIsActive(thread.runtime), | ||
| canShareWithGuest: appAtomRegistry.get( | ||
| canShareWithGuestAtom(threadRef.environmentId), | ||
| ), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: pingdotgg/t3code
Length of output: 6419
Script executed:
Repository: pingdotgg/t3code
Length of output: 34298
Script executed:
Repository: pingdotgg/t3code
Length of output: 41074
Script executed:
Repository: pingdotgg/t3code
Length of output: 19357
Exclude work that holds completion.
An awaited background task can make the runtime idle while the Working shelf shows Waiting. Mark unread remains visible, but the completion pill cannot appear until the work ends. Apply the same eligibility rule to the individual menus. Keep unawaited monitors eligible.
Update bulk eligibility