Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-7286: fix(inbox): re-read inbox lists that an issue write left behind (#8312)
Bohan Jianga922c43d6fae
diff --git a/packages/core/inbox/ws-updaters.test.ts b/packages/core/inbox/ws-updaters.test.tsindex 4f19118395..134a143141 100644--- a/packages/core/inbox/ws-updaters.test.ts+++ b/packages/core/inbox/ws-updaters.test.ts@@ -2,6 +2,7 @@import { describe, it, expect, vi } from "vitest";import { QueryClient, QueryObserver } from "@tanstack/react-query";import {+ cancelInboxLists,onInboxInvalidate,onInboxIssueDeleted,onInboxNew,@@ -310,6 +311,38 @@ it("does not refetch fresh lists for issue projection changes", async () => {}});+// The mutation-level regression (the write re-reads what it interrupted) lives+// in issues/mutations.test.tsx.+describe.each([+ ["main", inboxKeys.list(wsId)],+ ["archived", inboxKeys.archived(wsId)],+] as const)("cancelInboxLists on the %s inbox", (_view, queryKey) => {+ it("reports and cancels only a request that is in flight", async () => {+ const qc = new QueryClient();+ const loaded = [makeItem("i1", "issue-a")];+ let release!: (items: InboxItem[]) => void;+ const queryFn = vi+ .fn<() => Promise<InboxItem[]>>()+ .mockResolvedValueOnce(loaded)+ .mockImplementationOnce(+ () => new Promise((resolve) => (release = resolve)),+ );+ try {+ await qc.fetchQuery({ queryKey, queryFn });+ expect(cancelInboxLists(qc, wsId)).toBe(false);++ const refetch = qc.fetchQuery({ queryKey, queryFn });+ expect(cancelInboxLists(qc, wsId)).toBe(true);+ expect(qc.getQueryState(queryKey)?.fetchStatus).toBe("idle");+ release([makeItem("i2", "issue-b"), ...loaded]);+ await expect(refetch).resolves.toEqual(loaded);+ expect(qc.getQueryData(queryKey)).toEqual(loaded);+ } finally {+ qc.clear();+ }+ });+});+// MUL-6967 regression: the inbox list must pick up a change that happens while// its FIRST load is still in flight. Plain invalidation cannot do that —// TanStack only cancels an in-flight request on invalidation once the querydiff --git a/packages/core/inbox/ws-updaters.ts b/packages/core/inbox/ws-updaters.tsindex 17478ee67c..7d46ee455f 100644--- a/packages/core/inbox/ws-updaters.ts+++ b/packages/core/inbox/ws-updaters.ts@@ -136,16 +136,45 @@ export async function onInboxIssueDeleted(await onInboxSummaryInvalidate(qc);}+// Whether a request for either inbox list is out (paused ones included).+export function isInboxListRequestInFlight(+ qc: QueryClient,+ wsId: string,+): boolean {+ return qc+ .getQueryCache()+ .findAll({ queryKey: inboxKeys.all(wsId) })+ .some((query) => query.state.fetchStatus !== "idle");+}++// An optimistic issue write patches the status / priority on inbox rows, so it+// first cancels the lists' in-flight requests: a response read before the write+// would land on top of the patch. Returns whether a request was interrupted.+//+// The interrupted request may be the only one carrying a server change (an+// `inbox:new`, a reconnect), and nothing asks again. The cancel can also drop+// the invalidation mark: TanStack reverts to its pre-fetch snapshot, and a+// `setQueryData` during the fetch overwrites that snapshot with a+// non-invalidated state. So a write that interrupted a request owes the lists+// a re-read once the writes settle (MUL-7286). Writes that interrupt nothing+// stay request-free.+export function cancelInboxLists(qc: QueryClient, wsId: string): boolean {+ const interrupted = isInboxListRequestInFlight(qc, wsId);+ void qc.cancelQueries({ queryKey: inboxKeys.all(wsId) });+ return interrupted;+}+// THE entry point for refreshing the workspace's inbox lists — main and// archived. Every inbox event can move an item across that boundary (archive,// unarchive, or a new notification reviving an archived issue), and the split// is decided server-side, so the two are always refreshed together.//-// Cancels first, like the summary refresh below, and for the same reason. The-// list's first load is where the hole bites hardest: nothing outside the Inbox-// page observes the list, so on web it is collected once the user has been-// away, and every return is a first load again — with notifications arriving-// while a large, unbounded list is still downloading.+// Cancels first, like the summary refresh below, and for the same reason: the+// Inbox page is the only observer that fetches the list, so its first visit+// downloads a large, unbounded list while notifications keep arriving. After+// that the cache outlives the page — tab titles hold disabled observers on it+// (`useTabPresentation`) — so a return reuses it and refetches only while it+// is still marked invalidated.export async function onInboxInvalidate(qc: QueryClient, wsId: string) {await refreshInboxQuery(qc, inboxKeys.all(wsId));}diff --git a/packages/core/issues/mutations.test.tsx b/packages/core/issues/mutations.test.tsxindex 7be9a6cea1..d5f7e2238b 100644--- a/packages/core/issues/mutations.test.tsx+++ b/packages/core/issues/mutations.test.tsx@@ -3,11 +3,12 @@*/import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { act, renderHook, waitFor } from "@testing-library/react";-import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { QueryClient, QueryClientProvider, useQuery } from "@tanstack/react-query";import type { ReactNode } from "react";import { setApiInstance } from "../api";import type { ApiClient } from "../api/client";+import { createQueryClient } from "../query-client";import {useBatchUpdateIssues,useCreateComment,@@ -22,12 +23,17 @@ import {type IssueSortParam,} from "./queries";import { onIssueUpdated, onIssueAuxiliaryRevision } from "./ws-updaters";-import { inboxKeys } from "../inbox/queries";+import { inboxKeys, inboxListOptions } from "../inbox/queries";+import {+ onInboxInvalidate,+ onInboxIssueStatusChanged,+} from "../inbox/ws-updaters";import type {InboxItem,Issue,ListIssuesCache,TimelineEntry,+ UpdateIssueRequest,} from "../types";vi.mock("../hooks", () => ({@@ -792,6 +798,349 @@ describe("useBatchUpdateIssues — optimistic patch covers filtered boards too",});});+// MUL-7286: a status / priority write cancels the Inbox list's in-flight+// request so it cannot land on top of the optimistic patch. Whatever that+// request was carrying — here a new notification — must be re-read once the+// write settles, or the unread badge counts a row the list never shows. The+// cancel primitive itself is covered in inbox/ws-updaters.test.ts.+describe("status / priority writes re-read an Inbox list they left behind", () => {+ const readItem = makeInboxItem("n1", "issue-1", {+ read: true,+ issue_priority: "none",+ });+ const notification = makeInboxItem("n2", "issue-2", {+ created_at: "2025-01-02T00:00:00Z",+ });+ const writes = [+ {+ name: "useUpdateIssue",+ write: (hooks: WriteHooks) =>+ hooks.single.mutateAsync({ id: "issue-1", priority: "high" }),+ },+ {+ name: "useBatchUpdateIssues",+ write: (hooks: WriteHooks) =>+ hooks.batch.mutateAsync({ ids: ["issue-1"], updates: { priority: "high" } }),+ },+ ];++ let qc: QueryClient;+ const unmounts: Array<() => void> = [];++ function renderWriteHooks() {+ const hooks = renderHook(+ () => ({ single: useUpdateIssue(), batch: useBatchUpdateIssues() }),+ { wrapper: createWrapper(qc) },+ );+ unmounts.push(hooks.unmount);+ return hooks.result;+ }+ type WriteHooks = ReturnType<typeof renderWriteHooks>["current"];++ function mountInbox() {+ const page = renderHook(() => useQuery(inboxListOptions(WS_ID)), {+ wrapper: createWrapper(qc),+ });+ unmounts.push(page.unmount);+ return page.result;+ }++ function mockApi(+ listInbox: () => Promise<InboxItem[]>,+ { fail = false }: { fail?: boolean } = {},+ ) {+ const settle = <T,>(value: T) =>+ fail ? Promise.reject(new Error("boom")) : Promise.resolve(value);+ setApiInstance({+ listInbox,+ updateIssue: () => settle(makeIssue(1, { priority: "high" })),+ batchUpdateIssues: () => settle({ updated: 1 }),+ } as unknown as ApiClient);+ }++ beforeEach(() => {+ qc = createQueryClient();+ });++ afterEach(() => {+ unmounts.splice(0).forEach((unmount) => unmount());+ qc.clear();+ });++ it.each(+ writes.flatMap((w) => [+ { ...w, issueEvent: false },+ { ...w, issueEvent: true },+ ]),+ )(+ "$name re-reads the request it interrupted (issue event meanwhile: $issueEvent)",+ async ({ write, issueEvent }) => {+ let release!: (items: InboxItem[]) => void;+ const listInbox = vi+ .fn<() => Promise<InboxItem[]>>()+ .mockResolvedValueOnce([readItem])+ .mockImplementationOnce(+ () => new Promise((resolve) => (release = resolve)),+ )+ .mockResolvedValue([notification, readItem]);+ mockApi(listInbox);+ const hooks = renderWriteHooks();+ const inbox = mountInbox();+ await waitFor(() => expect(inbox.current.data).toEqual([readItem]));++ // `inbox:new` while the Inbox is open; the list re-read is still out.+ act(() => {+ void onInboxInvalidate(qc, WS_ID);+ });+ await waitFor(() => expect(listInbox).toHaveBeenCalledTimes(2));+ expect(qc.getQueryState(inboxKeys.list(WS_ID))?.fetchStatus).toBe("fetching");+ if (issueEvent) {+ // An `issue:updated` patching a listed row mid-request replaces the+ // snapshot TanStack reverts to on cancel with a non-invalidated state.+ onInboxIssueStatusChanged(qc, WS_ID, "issue-1", "in_progress");+ }++ await act(async () => {+ await write(hooks.current);+ });+ release([notification, readItem]); // interrupted: its response is dropped++ await waitFor(() =>+ expect(inbox.current.data?.map((item) => item.id)).toEqual(["n2", "n1"]),+ );+ expect(listInbox).toHaveBeenCalledTimes(3);+ },+ );++ it.each(writes)(+ "$name adds no Inbox request when it interrupts none",+ async ({ write }) => {+ const listInbox = vi+ .fn<() => Promise<InboxItem[]>>()+ .mockResolvedValue([readItem]);+ mockApi(listInbox);+ const hooks = renderWriteHooks();+ const inbox = mountInbox();+ await waitFor(() => expect(inbox.current.data).toEqual([readItem]));++ await act(async () => {+ await write(hooks.current);+ });++ await waitFor(() =>+ expect(inbox.current.data?.[0]?.issue_priority).toBe("high"),+ );+ expect(listInbox).toHaveBeenCalledTimes(1);+ },+ );++ it.each(writes)(+ "$name keeps the pending refresh when a failed write rolls the rows back",+ async ({ write }) => {+ const listInbox = vi.fn<() => Promise<InboxItem[]>>();+ mockApi(listInbox, { fail: true });+ // The user is elsewhere: the list is cached, nothing observes it, and an+ // `inbox:new` has marked it to re-read on the next visit.+ qc.setQueryData<InboxItem[]>(inboxKeys.list(WS_ID), [readItem]);+ await onInboxInvalidate(qc, WS_ID);+ const hooks = renderWriteHooks();++ await act(async () => {+ await write(hooks.current).catch(() => {});+ });++ await waitFor(() =>+ expect(qc.getQueryState(inboxKeys.list(WS_ID))?.isInvalidated).toBe(true),+ );+ expect(qc.getQueryData(inboxKeys.list(WS_ID))).toEqual([readItem]);+ expect(listInbox).not.toHaveBeenCalled();+ },+ );++ // Writes that overlap each other or a list request: the re-read must come+ // after the last save, or it reads a pending write's old value and lands on+ // top of its patch.+ describe("overlapping writes", () => {+ const rowA = makeInboxItem("n-a", "issue-1", { read: true, issue_priority: "none" });+ const rowB = makeInboxItem("n-b", "issue-2", { read: true, issue_priority: "none" });+ const newRow = makeInboxItem("n-c", "issue-3", {+ issue_priority: "none",+ created_at: "2025-01-02T00:00:00Z",+ });+ type Kind = "useUpdateIssue" | "useBatchUpdateIssues";++ // List reads and saves complete only when the test says so. A read answers+ // with the rows as they were when it reached the server.+ function controlledServer(initial: InboxItem[]) {+ let rows = initial;+ const reads: Array<() => void> = [];+ const saves = new Map<string, () => void>();+ const listInbox = vi.fn(() => {+ const snapshot = rows;+ return new Promise<InboxItem[]>((resolve) =>+ reads.push(() => resolve(snapshot)),+ );+ });+ const save = (id: string, priority: UpdateIssueRequest["priority"]) =>+ new Promise<void>((resolve) =>+ saves.set(id, () => {+ rows = rows.map((row) =>+ row.issue_id === id ? { ...row, issue_priority: priority } : row,+ );+ resolve();+ }),+ );+ setApiInstance({+ listInbox,+ updateIssue: (id: string, data: UpdateIssueRequest) =>+ save(id, data.priority).then(() => ({ ...makeIssue(1), ...data, id })),+ batchUpdateIssues: (ids: string[], updates: UpdateIssueRequest) =>+ save(ids[0]!, updates.priority).then(() => ({ updated: ids.length })),+ } as unknown as ApiClient);+ return {+ listInbox,+ setRows: (next: InboxItem[]) => {+ rows = next;+ },+ answerReads: () => reads.splice(0).forEach((answer) => answer()),+ saving: (id: string) => saves.has(id),+ commit: (id: string) => saves.get(id)!(),+ };+ }++ function write(hooks: WriteHooks, kind: Kind, id: string) {+ return kind === "useUpdateIssue"+ ? hooks.single.mutateAsync({ id, priority: "high" })+ : hooks.batch.mutateAsync({ ids: [id], updates: { priority: "high" } });+ }++ async function loadInbox(server: ReturnType<typeof controlledServer>) {+ const inbox = mountInbox();+ await waitFor(() => expect(server.listInbox).toHaveBeenCalledTimes(1));+ server.answerReads();+ await waitFor(() => expect(inbox.current.data).toBeDefined());+ return () => inbox.current.data?.map((row) => [row.id, row.issue_priority]);+ }++ const pairings = [+ ["useUpdateIssue", "useUpdateIssue"],+ ["useBatchUpdateIssues", "useBatchUpdateIssues"],+ ["useUpdateIssue", "useBatchUpdateIssues"],+ ["useBatchUpdateIssues", "useUpdateIssue"],+ ] as const;++ // An `inbox:new` re-read is out when A's write interrupts it; B's write+ // starts before A is saved and finds nothing to interrupt.+ async function overlapWrites(first: Kind, second: Kind) {+ const server = controlledServer([rowA, rowB]);+ const hooks = renderWriteHooks();+ const rendered = await loadInbox(server);+ server.setRows([newRow, rowA, rowB]);+ act(() => {+ void onInboxInvalidate(qc, WS_ID);+ });+ await waitFor(() => expect(server.listInbox).toHaveBeenCalledTimes(2));++ let writeA!: Promise<unknown>;+ let writeB!: Promise<unknown>;+ act(() => {+ writeA = write(hooks.current, first, "issue-1");+ });+ await waitFor(() => expect(server.saving("issue-1")).toBe(true));+ act(() => {+ writeB = write(hooks.current, second, "issue-2");+ });+ await waitFor(() => expect(server.saving("issue-2")).toBe(true));+ expect(qc.getQueryState(inboxKeys.list(WS_ID))?.fetchStatus).toBe("idle");+ return { server, rendered, writeA, writeB };+ }++ const everySaved = [+ ["n-c", "none"],+ ["n-a", "high"],+ ["n-b", "high"],+ ];++ it.each(pairings)(+ "re-reads once, after the last of them saves (%s, then %s)",+ async (first: Kind, second: Kind) => {+ const { server, rendered, writeA, writeB } = await overlapWrites(first, second);++ await act(async () => {+ server.commit("issue-1");+ await writeA;+ });+ await act(async () => {});+ // A owes the re-read, but reading while B is unsaved would miss B.+ expect(server.listInbox).toHaveBeenCalledTimes(2);++ await act(async () => {+ server.commit("issue-2");+ await writeB;+ });+ await waitFor(() => expect(server.listInbox).toHaveBeenCalledTimes(3));+ server.answerReads();++ await waitFor(() => expect(rendered()).toEqual(everySaved));+ },+ );++ it.each(pairings)(+ "re-reads when both saves land in the same tick (%s, then %s)",+ async (first: Kind, second: Kind) => {+ const { server, rendered, writeA, writeB } = await overlapWrites(first, second);++ // Each write settles while the other still counts as in flight.+ await act(async () => {+ server.commit("issue-1");+ server.commit("issue-2");+ await Promise.all([writeA, writeB]);+ });+ expect(qc.isMutating()).toBe(0);+ await waitFor(() => expect(server.listInbox).toHaveBeenCalledTimes(3));+ server.answerReads();++ await waitFor(() => expect(rendered()).toEqual(everySaved));+ },+ );++ it.each(["useUpdateIssue", "useBatchUpdateIssues"] as const)(+ "%s re-reads a list request that started while it was saving",+ async (kind: Kind) => {+ const server = controlledServer([rowA]);+ const hooks = renderWriteHooks();+ const rendered = await loadInbox(server);++ let writeA!: Promise<unknown>;+ act(() => {+ writeA = write(hooks.current, kind, "issue-1");+ });+ await waitFor(() => expect(server.saving("issue-1")).toBe(true));+ // `inbox:new` mid-save: this read reaches the server before A is saved.+ server.setRows([newRow, rowA]);+ act(() => {+ void onInboxInvalidate(qc, WS_ID);+ });+ await waitFor(() => expect(server.listInbox).toHaveBeenCalledTimes(2));++ await act(async () => {+ server.commit("issue-1");+ await writeA;+ });+ await waitFor(() => expect(server.listInbox).toHaveBeenCalledTimes(3));+ server.answerReads();++ await waitFor(() =>+ expect(rendered()).toEqual([+ ["n-c", "none"],+ ["n-a", "high"],+ ]),+ );+ },+ );+ });+});+describe("comment mutations — owner revision and last activity", () => {const issueId = "issue-1";const detailKey = issueKeys.detail(WS_ID, issueId);diff --git a/packages/core/issues/mutations.ts b/packages/core/issues/mutations.tsindex 22203d97ea..4df39178af 100644--- a/packages/core/issues/mutations.ts+++ b/packages/core/issues/mutations.ts@@ -1,9 +1,20 @@import { normalizeStatusPatch } from "./status-category";-import { hashKey, useMutation, useQueryClient, type QueryKey } from "@tanstack/react-query";+import {+ hashKey,+ useMutation,+ useQueryClient,+ type QueryClient,+ type QueryKey,+} from "@tanstack/react-query";import { api } from "../api";import { issueKeys } from "./queries";import { projectKeys } from "../projects/queries";import { inboxKeys } from "../inbox/queries";+import {+ cancelInboxLists,+ isInboxListRequestInFlight,+ onInboxInvalidate,+} from "../inbox/ws-updaters";import {applyIssueChange,invalidateIssueDerivatives,@@ -76,6 +87,58 @@ export type UpdateIssueMutationInput = {// Issue CRUD// ---------------------------------------------------------------------------+// Shared by the single and batch update hooks, so the inbox re-read can wait+// for the last of them (see `owedInboxRereads`).+const ISSUE_WRITE = "issue-write";+const issueWriteMutationKey = (wsId: string) => [ISSUE_WRITE, wsId] as const;++// Workspaces whose inbox lists owe a re-read, per client.+const inboxRereadsOwed = new WeakMap<QueryClient, Set<string>>();++// A client's owed re-reads, each paid once its workspace has no issue write+// left in flight. Issued earlier, the re-read could read a pending write's old+// value and land after that write's patch, reverting a saved change. The check+// runs when a write reaches its terminal state, not in onSettled: TanStack+// calls onSettled while the mutation still counts as pending, so two writes+// settling in the same tick would each count the other and both skip+// (MUL-7286).+function owedInboxRereads(qc: QueryClient): Set<string> {+ const existing = inboxRereadsOwed.get(qc);+ if (existing) return existing;+ const owed = new Set<string>();+ inboxRereadsOwed.set(qc, owed);+ qc.getMutationCache().subscribe((event) => {+ if (event.type !== "updated") return;+ if (event.action.type !== "success" && event.action.type !== "error") return;+ const [kind, wsId] = event.mutation.options.mutationKey ?? [];+ if (kind !== ISSUE_WRITE || typeof wsId !== "string") return;+ if (!owed.has(wsId)) return;+ if (qc.isMutating({ mutationKey: issueWriteMutationKey(wsId) }) > 0) return;+ owed.delete(wsId);+ void onInboxInvalidate(qc, wsId);+ });+ return owed;+}++// Inbox side of settling a status / priority write. It patched the inbox rows+// optimistically, so the lists owe a re-read only when the write left them+// behind the server: onMutate interrupted one of their requests (see+// `cancelInboxLists`), a failure restored their rollback snapshot, or a list+// request is still out and may have read the server before this write+// committed. Otherwise the patch was the whole change, and no request is added.+function settleInboxAfterIssueWrite(+ qc: QueryClient,+ wsId: string,+ // Set by onMutate for status / priority writes only.+ inboxWrite: { interrupted: boolean } | undefined,+ failed: boolean,+) {+ if (!inboxWrite) return;+ if (inboxWrite.interrupted || failed || isInboxListRequestInFlight(qc, wsId)) {+ owedInboxRereads(qc).add(wsId);+ }+}+function useIssueCreateMutation<TVariables>(mutationFn: (variables: TVariables) => Promise<Issue>,) {@@ -126,6 +189,7 @@ export function useUpdateIssue() {const qc = useQueryClient();const wsId = useWorkspaceId();return useMutation({+ mutationKey: issueWriteMutationKey(wsId),mutationFn: ({ id, move_intent: moveIntent, ...data }: UpdateIssueMutationInput) => {if (!moveIntent) return api.updateIssue(id, data);const { position: _optimisticPosition, ...target } = data;@@ -154,9 +218,10 @@ export function useUpdateIssue() {qc.cancelQueries({ queryKey: issueKeys.myAll(wsId) });qc.cancelQueries({ queryKey: issueKeys.flatAll(wsId) });qc.cancelQueries({ queryKey: issueKeys.tableAll(wsId) });- if (patch.status !== undefined || patch.priority !== undefined) {- qc.cancelQueries({ queryKey: inboxKeys.all(wsId) });- }+ const inboxWrite =+ patch.status !== undefined || patch.priority !== undefined+ ? { interrupted: cancelInboxLists(qc, wsId) }+ : undefined;const prevDetail = qc.getQueryData<Issue>(issueKeys.detail(wsId, id));// The coordinator owns the cross-cache rules: surgical patch/rebucket// where the card is loaded and still belongs, surgical REMOVE where the@@ -212,7 +277,7 @@ export function useUpdateIssue() {: old?.map((c) => (c.id === id ? { ...c, ...normalizeStatusPatch(patch) } : c)),);}- return { change, prevChildren, parentId, id };+ return { change, prevChildren, parentId, id, inboxWrite };},onError: (_err, vars, ctx) => {if (ctx) {@@ -282,7 +347,8 @@ export function useUpdateIssue() {// The server has committed — safe to flush any drift it reported now.invalidateStaleListKeys(qc, reconcile.staleKeys);},- onSettled: (_data, _err, vars, ctx) => {+ onSettled: (_data, err, vars, ctx) => {+ settleInboxAfterIssueWrite(qc, wsId, ctx?.inboxWrite, err !== null);// The issue's own list + detail caches are reconciled surgically in// onSuccess / onError, so they are deliberately NOT invalidated here — a// full-list refetch on settle is what made drags flicker. Only aggregate@@ -429,6 +495,7 @@ export function useBatchUpdateIssues() {const qc = useQueryClient();const wsId = useWorkspaceId();return useMutation({+ mutationKey: issueWriteMutationKey(wsId),mutationFn: ({ids,updates,@@ -451,9 +518,10 @@ export function useBatchUpdateIssues() {await qc.cancelQueries({ queryKey: issueKeys.myAll(wsId) });await qc.cancelQueries({ queryKey: issueKeys.flatAll(wsId) });await qc.cancelQueries({ queryKey: issueKeys.tableAll(wsId) });- if (patch.status !== undefined || patch.priority !== undefined) {- await qc.cancelQueries({ queryKey: inboxKeys.all(wsId) });- }+ const inboxWrite =+ patch.status !== undefined || patch.priority !== undefined+ ? { interrupted: cancelInboxLists(qc, wsId) }+ : undefined;// Run every issue through the coordinator — the same rules table the// single-issue update uses, so a batch edit patches/removes across the@@ -532,6 +600,7 @@ export function useBatchUpdateIssues() {prevDetailById,prevInboxList,prevArchivedInboxList,+ inboxWrite,staleKeys,prevChildren,affectedParentIds,@@ -573,7 +642,8 @@ export function useBatchUpdateIssues() {}}},- onSettled: (_data, _err, _vars, ctx) => {+ onSettled: (_data, err, _vars, ctx) => {+ settleInboxAfterIssueWrite(qc, wsId, ctx?.inboxWrite, err !== null);// Deliberately NOT invalidating issueKeys.list / myAll here: the onMutate// pass above is a complete surgical reconcile for the loaded bucketed// boards, so a full-board refetch on settle would only re-introduce thediff --git a/packages/core/realtime/use-realtime-sync-inbox.test.tsx b/packages/core/realtime/use-realtime-sync-inbox.test.tsxindex ab1b08d43e..9729567c12 100644--- a/packages/core/realtime/use-realtime-sync-inbox.test.tsx+++ b/packages/core/realtime/use-realtime-sync-inbox.test.tsx@@ -95,7 +95,8 @@ it("refreshes an inactive Inbox after inbox:new then issue:updated (MUL-7286)",let page = mountInbox();try {await waitFor(() => expect(page.result.current.data).toEqual([oldItem]));- // Switching desktop tabs unmounts the page but keeps its cache for 10 min.+ // Switching tabs unmounts the page; its cache stays (tab titles hold+ // disabled observers on it), so the return reuses it.page.unmount();const newItem = {...oldItem,