Skip to content

Commit 2f02d85

Browse files
committed
fix(web): allow Working threads as chat references
1 parent 77823bd commit 2f02d85

3 files changed

Lines changed: 32 additions & 3 deletions

File tree

‎apps/web/src/components/Sidebar.logic.test.ts‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,6 +2218,33 @@ describe("Working shelf (beta)", () => {
22182218
expect(resolveSidebarDropVerb("active", "working")).toBeNull();
22192219
});
22202220

2221+
it.each([
2222+
["pinned", "p1"],
2223+
["active", "a2"],
2224+
["settled", "s1"],
2225+
] as const)(
2226+
"does not move a Working thread into %s when its reference drag ends in the sidebar",
2227+
(section, overKey) => {
2228+
const target = resolveSidebarDropTarget(items, "w1", overKey);
2229+
expect(target?.section).toBe(section);
2230+
expect(
2231+
planSidebarThreadDrop({
2232+
activeKey: "w1",
2233+
activeSection: "working",
2234+
target: target!,
2235+
pinnedOrder: ["p1"],
2236+
pinnedKeysById: new Map([["p1", "m"]]),
2237+
activeOrder: ["a1", "a2"],
2238+
activeKeysById: new Map([
2239+
["a1", "f"],
2240+
["a2", "t"],
2241+
]),
2242+
activeTimeOrdered: true,
2243+
}),
2244+
).toEqual({ kind: "none" });
2245+
},
2246+
);
2247+
22212248
it("only changes lifecycle when the inbox is time-ordered", () => {
22222249
const base = {
22232250
pinnedOrder: ["p1"],

‎apps/web/src/components/Sidebar.logic.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ export const animateSidebarLayoutChanges: AnimateLayoutChanges = (args) =>
129129
// and active threads keep the dragged position; settled threads use time
130130
// order. Snoozed rows can leave the shelf, but dropping into it is not
131131
// supported because snoozing requires a wake time. The Working shelf (beta)
132-
// follows live status, so it is neither a drag source nor a destination.
132+
// follows live status, so its rows only drag out as chat context, never
133+
// between sidebar sections.
133134

134135
export type SidebarSection = "pinned" | "active" | "working" | "snoozed" | "settled";
135136

@@ -305,6 +306,7 @@ export function planSidebarThreadDrop(input: {
305306
activeKeysById,
306307
activeReorderableKeys,
307308
} = input;
309+
if (activeSection === "working") return { kind: "none" };
308310
if (input.supportsSettlement === false && (target.section === "settled" || activeSettled)) {
309311
return { kind: "none" };
310312
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3339,7 +3339,8 @@ export default function Sidebar() {
33393339
readonly targetSection: SidebarSection | null;
33403340
readonly contextDrag: boolean;
33413341
} | null>(null);
3342-
const isContextDrag = dragState?.contextDrag === true;
3342+
// Working rows can supply chat context, but never preview sidebar movement.
3343+
const isContextDrag = dragState?.contextDrag === true || dragState?.activeSection === "working";
33433344
const dragTargetSection = isContextDrag ? null : (dragState?.targetSection ?? null);
33443345
const dragSensorRef = useRef<SidebarPointerSensor | null>(null);
33453346
const contextDragKeyRef = useRef<string | null>(null);
@@ -5061,7 +5062,6 @@ export default function Sidebar() {
50615062
contextDrag={isContextDrag}
50625063
disabled={
50635064
renamingThreadKey === threadKey ||
5064-
section === "working" ||
50655065
!draggableThreadKeys.has(threadKey) ||
50665066
optimisticDrop !== null
50675067
}

0 commit comments

Comments
 (0)