Skip to content

Commit 94ca7ce

Browse files
committed
fix(web): links to older settled threads show their title
Shells leave older settled threads out, so thread link chips could not find them and showed "Thread no longer available". The chips now read the thread's family when it is not in the local shells. Fixes #26467
1 parent eb751fa commit 94ca7ce

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎apps/web/src/components/ThreadContextChip.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Link } from "@tanstack/react-router";
44
import { MessagesSquareIcon } from "lucide-react";
55

66
import { useProject, useThreadShell } from "~/state/entities";
7+
import { useThreadFamily } from "~/state/threads";
78
import { ContextChip, ContextChipLabel } from "./ContextChip";
89
import { ProjectFavicon } from "./ProjectFavicon";
910
import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
@@ -15,6 +16,8 @@ export function ThreadContextChip(props: {
1516
}) {
1617
const { environmentId, threadId } = props.record;
1718
const shell = useThreadShell({ environmentId, threadId });
19+
// Shells leave older settled threads out; the family read brings this one in.
20+
useThreadFamily(environmentId, shell === null ? threadId : null);
1821
const project = useProject(shell ? scopeProjectRef(environmentId, shell.projectId) : null);
1922
const title = shell?.title?.trim() || props.record.title;
2023
return (

‎apps/web/src/components/chat/MarkdownThreadLink.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
} from "@t3tools/shared/threadLinks";
1010

1111
import { useThreadRefs, useThreadShell } from "../../state/entities";
12+
import { useThreadFamily } from "../../state/threads";
1213
import { UnresolvedChip } from "../contextChipParts";
1314
import { ThreadContextChip } from "../ThreadContextChip";
1415

@@ -25,6 +26,8 @@ export function MarkdownThreadLink(props: {
2526
written === null && decodedId !== null ? scopeThreadRef(environmentId, decodedId) : null,
2627
);
2728
const local = written ?? decoded;
29+
// Shells leave older settled threads out; the family read brings the linked one in.
30+
useThreadFamily(environmentId, local === null ? (decodedId ?? props.link.threadId) : null);
2831
const guess = local === null && props.link.environmentId === null;
2932
const refs = useThreadRefs(guess);
3033
const remote = useThreadShell(guess ? guessThreadLinkRef(props.link, refs) : null);

0 commit comments

Comments
 (0)