Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
27af15a
feat(server): hide threads from the sidebar
flamboh Dec 3, 2026
4d6698c
feat(web): Hidden fold in the sidebar
flamboh Dec 3, 2026
6f057f5
feat(mobile): Hidden shelf in the thread list
flamboh Dec 3, 2026
b7afa99
fix(mobile): hidden rows no longer stay slid out after a hide
flamboh Dec 3, 2026
73bf469
fix(mobile): settled pager reads "Show N more"
flamboh Dec 3, 2026
59b8b83
fix(server): hidden threads never settle, snooze on limits, or notify…
flamboh Dec 3, 2026
cc4988d
feat(mcp): thread list reports and filters hidden threads
flamboh Dec 3, 2026
77db3b0
fix(web): hidden threads stay quiet, never offer Settle, and undo bac…
flamboh Dec 3, 2026
1df1a4b
fix(mobile): hidden rows swipe to Unhide and never offer Settle
flamboh Dec 3, 2026
444fd9a
docs(user): describe the hidden thread rules
flamboh Dec 3, 2026
840d0ce
fix(server): hiding keeps a thread's explicit active override
flamboh Dec 3, 2026
72ace66
fix(client): undoing an offline snooze of a hidden thread keeps it hi…
flamboh Dec 3, 2026
19c70b3
test: fold hidden-thread cases into existing tables and tidy naming
flamboh Dec 3, 2026
c826d65
fix(client): optimistic Hide clears settled state like the server
flamboh Dec 3, 2026
68e2752
fix(web): bulk Hide only skips threads it actually hides when navigating
flamboh Dec 3, 2026
033b44b
fix(web): Hidden shelf no longer shifts during a reorder with spare s…
flamboh Dec 3, 2026
62054b4
fix(web): undoing a snooze on a hidden thread works while offline
flamboh Dec 3, 2026
27f93b8
fix(mobile): Show more counts only the page it reveals
flamboh Dec 3, 2026
57f88a0
fix(client): undoing Hide puts a settled thread back in its Settled p…
flamboh Dec 3, 2026
3df90a1
fix(server): unhiding a running thread republishes its live activity
flamboh Dec 3, 2026
1a6036c
fix(server): unhiding no longer lets a later rename re-alert an old r…
flamboh Dec 3, 2026
6312df6
fix(server): a result that finished while hidden never alerts after u…
flamboh Dec 3, 2026
8bb5fd6
fix(server): a thread's last unhide is stored data, so old results st…
flamboh Dec 3, 2026
47b6c8f
fix(client): hiding a thread cancels its older Settle undo
flamboh Dec 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/mobile/src/features/home/HomeRouteScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ export function HomeRouteScreen() {
unsnoozeThread,
pinThread,
unpinThread,
hideThread,
unhideThread,
setThreadAutoSettle,
moveThread,
renameThread,
Expand Down Expand Up @@ -202,6 +204,8 @@ export function HomeRouteScreen() {
onUnsettleThread={unsettleThread}
onPinThread={pinThread}
onUnpinThread={unpinThread}
onHideThread={hideThread}
onUnhideThread={unhideThread}
onSetThreadAutoSettle={setThreadAutoSettle}
onMoveThread={moveThread}
onRenameThread={renameThread}
Expand Down
44 changes: 31 additions & 13 deletions apps/mobile/src/features/home/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import {
ThreadListV2SettledShelfHeader,
ThreadListV2ShowMoreRow,
ThreadListV2SnoozedShelfHeader,
ThreadListV2HiddenShelfHeader,
ThreadListV2WorkingShelfHeader,
} from "../threads/thread-list-v2-items";
import { useThreadRowProviderInstanceResolver } from "../threads/thread-provider-instance";
Expand Down Expand Up @@ -146,6 +147,8 @@ interface HomeScreenProps {
readonly onUnsettleThread: (thread: EnvironmentThreadShell) => void;
readonly onPinThread: (thread: EnvironmentThreadShell) => Promise<boolean>;
readonly onUnpinThread: (thread: EnvironmentThreadShell) => Promise<boolean>;
readonly onHideThread: (thread: EnvironmentThreadShell) => Promise<boolean>;
readonly onUnhideThread: (thread: EnvironmentThreadShell) => Promise<boolean>;
readonly onSetThreadAutoSettle: (
thread: EnvironmentThreadShell,
enabled: boolean,
Expand Down Expand Up @@ -380,6 +383,8 @@ export function HomeScreen(props: HomeScreenProps) {
const handlePinThread = props.onPinThread;
const handleMoveThread = props.onMoveThread;
const handleUnpinThread = props.onUnpinThread;
const handleHideThread = props.onHideThread;
const handleUnhideThread = props.onUnhideThread;
const handleSetThreadAutoSettle = props.onSetThreadAutoSettle;
const handleRegenerateThreadTitle = props.onRegenerateThreadTitle;
const handleRenameThread = props.onRenameThread;
Expand All @@ -398,10 +403,12 @@ export function HomeScreen(props: HomeScreenProps) {
setSettledVisibleCount((count) => count + THREAD_LIST_V2_SETTLED_PAGE_COUNT);
const {
loaded: shelfPreferencesLoaded,
hiddenShelfExpanded,
settledShelfExpanded,
snoozedShelfExpanded,
workingShelfEnabled,
workingShelfExpanded,
toggleHiddenShelf,
toggleSettledShelf,
toggleSnoozedShelf,
toggleWorkingShelf,
Expand All @@ -417,6 +424,7 @@ export function HomeScreen(props: HomeScreenProps) {
snoozePresetsByEnvironmentId,
pinningEnvironmentIds,
autoSettleOptOutEnvironmentIds,
hideEnvironmentIds,
pinReorderEnvironmentIds,
activeReorderEnvironmentIds,
titleRegenerationEnvironmentIds,
Expand Down Expand Up @@ -450,6 +458,7 @@ export function HomeScreen(props: HomeScreenProps) {
workingShelfExpanded,
snoozedShelfExpanded,
settledShelfExpanded,
hiddenShelfExpanded,
selectedThreadKey,
});
// Called as `props.onSelectThread(...)`, the compiler would cache this handler on the whole
Expand Down Expand Up @@ -539,6 +548,25 @@ export function HomeScreen(props: HomeScreenProps) {
/>
);
}
if (item.type === "v2-show-more") {
return (
<ThreadListV2ShowMoreRow
moreCount={item.moreCount}
{...(item.state === undefined ? {} : { state: item.state })}
onPress={() => showMoreOlderSettled(olderSettledShelf, showMoreSettled)}
/>
);
}
if (item.type === "v2-hidden-shelf") {
return (
<ThreadListV2HiddenShelfHeader
count={item.count}
disabled={item.disabled}
expanded={item.expanded}
onToggle={toggleHiddenShelf}
/>
);
}
const thread = item.item.thread;
const rowPermissions =
rowPermissionsByEnvironmentId.get(thread.environmentId) ?? DEFAULT_THREAD_ROW_PERMISSIONS;
Expand Down Expand Up @@ -601,6 +629,7 @@ export function HomeScreen(props: HomeScreenProps) {
snoozePresets={snoozePresetsByEnvironmentId.get(thread.environmentId)}
pinningSupported={pinningEnvironmentIds.has(thread.environmentId)}
autoSettleOptOutSupported={autoSettleOptOutEnvironmentIds.has(thread.environmentId)}
hideSupported={hideEnvironmentIds.has(thread.environmentId)}
reorderSupported={
item.item.pinned
? pinReorderEnvironmentIds.has(thread.environmentId)
Expand All @@ -613,6 +642,8 @@ export function HomeScreen(props: HomeScreenProps) {
onUnsettleThread={handleUnsettleThread}
onPinThread={handlePinThread}
onUnpinThread={handleUnpinThread}
onHideThread={handleHideThread}
onUnhideThread={handleUnhideThread}
onSetThreadAutoSettle={handleSetThreadAutoSettle}
onMoveThread={handleMoveThread}
onSwipeableClose={handleSwipeableClose}
Expand Down Expand Up @@ -815,19 +846,6 @@ export function HomeScreen(props: HomeScreenProps) {
ListHeaderComponent={v2ListHeader}
// Lifted above the rows so an iOS filter menu's dismissal morph is not covered.
ListHeaderComponentStyle={{ zIndex: 1 }}
ListFooterComponent={
settledShelfExpanded && threadListV2Layout.hiddenSettledCount > 0 ? (
<ThreadListV2ShowMoreRow
hiddenCount={threadListV2Layout.hiddenSettledCount}
{...(olderSettledShelf.loading
? { state: "loading" as const }
: olderSettledShelf.failed
? { state: "failed" as const }
: {})}
onPress={() => showMoreOlderSettled(olderSettledShelf, showMoreSettled)}
/>
) : null
}
ListEmptyComponent={v2ListEmpty}
style={{ flex: 1 }}
automaticallyAdjustsScrollIndicatorInsets={Platform.OS === "ios"}
Expand Down
4 changes: 3 additions & 1 deletion apps/mobile/src/features/home/ThreadUndoNotice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ export function ThreadUndoNotice(props: {
? gt`Settled thread`
: notice.action === "Snoozed"
? gt`Snoozed thread`
: gt`Unpinned thread`
: notice.action === "Hidden"
? gt`Hidden thread`
: gt`Unpinned thread`
}
action={{
label: gt`Undo`,
Expand Down
4 changes: 3 additions & 1 deletion apps/mobile/src/features/home/thread-swipe-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {
const [actionsFor, setActionsFor] = useState<typeof content | null>(null);
const [isDismissing, setIsDismissing] = useState(false);
const [collapsedInList, setCollapsedInList] = useState(false);
const [restoredDismissals, setRestoredDismissals] = useState(0);
const dismissing = useSharedValue(false);
const rowHeight = useSharedValue(0);
const rowWidth = useSharedValue(props.fullSwipeWidth);
Expand All @@ -324,6 +325,7 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {

const restoreRow = useCallback(() => {
if (!mountedRef.current) return;
if (dismissalRef.current !== null) setRestoredDismissals((count) => count + 1);
dismissalRef.current = null;
setActionsFor(null);
// RN-to-UI jobs run in order, so this also resets a queued dismissal.
Expand Down Expand Up @@ -569,7 +571,7 @@ export function ThreadSwipeable(props: ThreadSwipeableProps) {

return (
<View style={collapsedInList ? COLLAPSED_ROW_STYLE : undefined}>
<Animated.View style={dismissStyle}>
<Animated.View key={restoredDismissals} style={dismissStyle}>
<View onLayout={onRowLayout}>
<ReanimatedSwipeable
ref={swipeableRef}
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/features/home/thread-undo-notice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as ThreadUndo from "@t3tools/client-runtime/state/thread-undo";
import { useSyncExternalStore } from "react";

type UndoNotice = {
readonly action: "Settled" | "Snoozed" | "Unpinned";
readonly action: "Settled" | "Snoozed" | "Unpinned" | "Hidden";
readonly claim: ReturnType<typeof ThreadUndo.begin>;
readonly undo: () => Promise<void>;
};
Expand Down
120 changes: 108 additions & 12 deletions apps/mobile/src/features/home/useThreadListActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ function environmentSupportsAutoSettleOptOut(
);
}

function environmentSupportsThreadHide(environmentId: EnvironmentThreadShell["environmentId"]) {
return (
appAtomRegistry.get(environmentServerConfigsAtom).get(environmentId)?.environment.capabilities
.threadHide === true
);
}

type ThreadListAction = "archive" | "unarchive" | "delete" | "settle" | "unsettle";

const ACTION_FAILURES: Record<ThreadListAction, string> = {
Expand Down Expand Up @@ -206,7 +213,7 @@ function useThreadActionExecutor(
}
onSucceeded?.(result.value);
if (action === "archive" || action === "delete") {
for (const kind of ["settle", "snooze", "pin"]) ThreadUndo.invalidate(kind, key);
ThreadUndo.invalidatePlacement(key);
}
if (action === "archive" || action === "unarchive" || action === "delete") {
refreshArchivedThreadsForEnvironment(thread.environmentId);
Expand Down Expand Up @@ -252,6 +259,8 @@ export function useThreadListActions(): {
readonly unsettleThread: (thread: EnvironmentThreadShell) => Promise<boolean>;
readonly pinThread: (thread: EnvironmentThreadShell) => Promise<boolean>;
readonly unpinThread: (thread: EnvironmentThreadShell) => Promise<boolean>;
readonly hideThread: (thread: EnvironmentThreadShell) => Promise<boolean>;
readonly unhideThread: (thread: EnvironmentThreadShell) => Promise<boolean>;
readonly setThreadAutoSettle: (
thread: EnvironmentThreadShell,
enabled: boolean,
Expand All @@ -268,6 +277,10 @@ export function useThreadListActions(): {
const unsnoozeMutation = useAtomCommand(threadEnvironment.unsnooze, { reportFailure: false });
const pinMutation = useAtomCommand(threadEnvironment.pin, { reportFailure: false });
const unpinMutation = useAtomCommand(threadEnvironment.unpin, { reportFailure: false });
const hideMutation = useAtomCommand(threadEnvironment.hide, { reportFailure: false });
const hideAgainMutation = useAtomCommand(threadEnvironment.hideAgain, { reportFailure: false });
const settleMutation = useAtomCommand(threadEnvironment.settle, { reportFailure: false });
const unhideMutation = useAtomCommand(threadEnvironment.unhide, { reportFailure: false });
const setAutoSettleMutation = useAtomCommand(threadEnvironment.setAutoSettle, {
reportFailure: false,
});
Expand All @@ -283,7 +296,7 @@ export function useThreadListActions(): {
const archiveThread = (thread: EnvironmentThreadShell) => executeAction("archive", thread);
const offerUndo = (
thread: EnvironmentThreadShell,
action: "Settled" | "Snoozed" | "Unpinned",
action: "Settled" | "Snoozed" | "Unpinned" | "Hidden",
claim: ReturnType<typeof ThreadUndo.begin>,
plan: ThreadUndo.ThreadUndoPlan,
) =>
Expand Down Expand Up @@ -317,6 +330,25 @@ export function useThreadListActions(): {
});
case "unsnooze":
return unsnoozeThread(thread);
case "unhide":
return unhideThread(thread);
case "hide":
case "settle": {
const result = await (step.action === "hide"
? hideAgainMutation({
environmentId: thread.environmentId,
input: { threadId: thread.id },
})
: settleMutation({
environmentId: thread.environmentId,
input: {
threadId: thread.id,
...(step.settledAt === undefined ? {} : { settledAt: step.settledAt }),
},
}));
if (result._tag === "Failure") throw Cause.squash(result.cause);
return true;
}
case "pin":
return pinThread(thread, step.orderKey);
case "reorderActive": {
Expand All @@ -331,7 +363,9 @@ export function useThreadListActions(): {
const failureTitle =
action === "Unpinned"
? m(msg("Could not undo unpin"))
: m(msg("Could not undo settle"));
: action === "Hidden"
? m(msg("Could not undo hide"))
: m(msg("Could not undo settle"));
if (!checkThreadOperationPermission(thread, failureTitle, true)) return false;
const result = await snoozeMutation({
environmentId: thread.environmentId,
Expand Down Expand Up @@ -414,6 +448,7 @@ export function useThreadListActions(): {
}

selectionHaptic();
ThreadUndo.invalidate("hide", key);
const claim = ThreadUndo.begin("snooze", key);
const result = await withThreadDismissal(
key,
Expand All @@ -438,7 +473,7 @@ export function useThreadListActions(): {
);
return false;
}
offerUndo(thread, "Snoozed", claim, ThreadUndo.planThreadUndo("snooze"));
offerUndo(thread, "Snoozed", claim, ThreadUndo.planThreadUndo("snooze", thread));
return true;
})();
snoozeInFlightThreadKeys.current.delete(key);
Expand Down Expand Up @@ -522,10 +557,7 @@ export function useThreadListActions(): {
restoreOrderKey === undefined
? (pinOrderKeyBetween(null, firstKey) ?? undefined)
: (restoreOrderKey ?? undefined);
ThreadUndo.invalidate("pin", scopedThreadKey(thread.environmentId, thread.id));
// Pinning clears snooze, so older Settled or Snoozed undos would fight this pin.
ThreadUndo.invalidate("settle", scopedThreadKey(thread.environmentId, thread.id));
ThreadUndo.invalidate("snooze", scopedThreadKey(thread.environmentId, thread.id));
ThreadUndo.invalidatePlacement(scopedThreadKey(thread.environmentId, thread.id));
const result = await withThreadDismissal(
scopedThreadKey(thread.environmentId, thread.id),
() =>
Expand Down Expand Up @@ -586,6 +618,67 @@ export function useThreadListActions(): {
offerUndo(thread, "Unpinned", claim, plan);
return true;
};
const hideThread = async (thread: EnvironmentThreadShell) => {
if (!checkThreadOperationPermission(thread, m(msg("Could not hide thread")))) return false;
if (!environmentSupportsThreadHide(thread.environmentId)) {
Dialog.alert(
m(msg("Could not hide thread")),
m(
msg(
"This environment's server does not support hiding yet. Update the server to use Hide.",
),
),
);
return false;
}
selectionHaptic();
const key = scopedThreadKey(thread.environmentId, thread.id);
const plan = ThreadUndo.planThreadUndo("hide", thread);
ThreadUndo.invalidatePlacement(key);
const claim = ThreadUndo.begin("hide", key);
const result = await withThreadDismissal(
key,
() =>
hideMutation({
environmentId: thread.environmentId,
input: { threadId: thread.id },
}),
(result) => result._tag === "Success",
);
if (result._tag === "Failure") {
claim.finish();
const error = Cause.squash(result.cause);
Dialog.alert(
m(msg("Could not hide thread")),
error instanceof Error && errorDisplayMessage(error, m) !== null
? (errorDisplayMessage(error, m) ?? error.message)
: m(msg("The thread could not be hidden.")),
);
return false;
}
offerUndo(thread, "Hidden", claim, plan);
return true;
};
const unhideThread = async (thread: EnvironmentThreadShell) => {
if (!checkThreadOperationPermission(thread, m(msg("Could not unhide thread")))) return false;
selectionHaptic();
ThreadUndo.invalidate("hide", scopedThreadKey(thread.environmentId, thread.id));
const result = await unhideMutation({
environmentId: thread.environmentId,
input: { threadId: thread.id },
});
if (result._tag === "Failure") {
const error = Cause.squash(result.cause);
Dialog.alert(
m(msg("Could not unhide thread")),
error instanceof Error && errorDisplayMessage(error, m) !== null
? (errorDisplayMessage(error, m) ?? error.message)
: m(msg("The thread could not be unhidden.")),
);
return false;
}
return true;
};
const setThreadAutoSettle = async (thread: EnvironmentThreadShell, enabled: boolean) => {
if (!environmentSupportsAutoSettleOptOut(thread.environmentId)) {
Dialog.alert(
Expand Down Expand Up @@ -791,10 +884,7 @@ export function useThreadListActions(): {
const orderKey = assignments.find(
({ id }) => id === scopedThreadKey(thread.environmentId, thread.id),
)?.orderKey;
// Same as pinThread: older Unpinned, Settled, or Snoozed undos would fight this pin.
ThreadUndo.invalidate("pin", scopedThreadKey(thread.environmentId, thread.id));
ThreadUndo.invalidate("settle", scopedThreadKey(thread.environmentId, thread.id));
ThreadUndo.invalidate("snooze", scopedThreadKey(thread.environmentId, thread.id));
ThreadUndo.invalidatePlacement(scopedThreadKey(thread.environmentId, thread.id));
const result = await pinMutation({
environmentId: thread.environmentId,
input: { threadId: thread.id, ...(orderKey === undefined ? {} : { orderKey }) },
Expand Down Expand Up @@ -873,6 +963,12 @@ export function useThreadListActions(): {
unpinThread: useStableCallback((thread: EnvironmentThreadShell) =>
unpinThread(liveThread(thread)),
),
hideThread: useStableCallback((thread: EnvironmentThreadShell) =>
hideThread(liveThread(thread)),
),
unhideThread: useStableCallback((thread: EnvironmentThreadShell) =>
unhideThread(liveThread(thread)),
),
setThreadAutoSettle: useStableCallback((thread: EnvironmentThreadShell, enabled: boolean) =>
setThreadAutoSettle(liveThread(thread), enabled),
),
Expand Down
Loading
Loading