Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(issues): keep private blockers listed after a realtime issue update (#11521)

pseudoyudd8feca8a812
diff --git a/packages/core/issues/ws-updaters.test.ts b/packages/core/issues/ws-updaters.test.ts
index 776784537f..a1cbaeb415 100644
--- a/packages/core/issues/ws-updaters.test.ts
+++ b/packages/core/issues/ws-updaters.test.ts
@@ -699,6 +699,51 @@ describe("onIssueUpdated — source deletion detaches sub-issues", () => {
});
});
+describe("onIssueUpdated — blockers stay this reader's own", () => {
+ it("keeps the cached blocked_by when a broadcast carries a narrower list", () => {
+ const qc = new QueryClient();
+ const privateBlocker = {
+ id: OTHER_ISSUE_ID,
+ identifier: "MUL-2",
+ title: "Private blocker",
+ status: "todo",
+ via: "manual",
+ closed: false,
+ };
+ const child: Issue = {
+ ...parentedIssue,
+ blocked_by: [privateBlocker],
+ blocked_count: 1,
+ revision: 1,
+ };
+ const detailKey = issueKeys.detail(WS_ID, ISSUE_ID);
+ const childrenKey = issueKeys.children(WS_ID, PARENT_ISSUE_ID);
+ const listKey = issueKeys.list(WS_ID);
+ qc.setQueryData(detailKey, child);
+ qc.setQueryData(childrenKey, [child]);
+ qc.setQueryData(listKey, makeListCache(child));
+
+ // The server strips cross-project private blockers from every broadcast.
+ onIssueUpdated(qc, WS_ID, {
+ ...child,
+ title: "Renamed",
+ blocked_by: [],
+ revision: 2,
+ });
+
+ const expected = {
+ title: "Renamed",
+ blocked_by: [privateBlocker],
+ blocked_count: 1,
+ revision: 2,
+ };
+ expect(qc.getQueryData(detailKey)).toMatchObject(expected);
+ expect(qc.getQueryData<ListIssuesCache>(listKey)?.byStatus.unstarted?.issues[0])
+ .toMatchObject(expected);
+ expect(qc.getQueryData<Issue[]>(childrenKey)?.[0]).toMatchObject(expected);
+ });
+});
+
describe("onIssueUpdated — position move is surgical, not a list refetch", () => {
let qc: QueryClient;
diff --git a/packages/core/issues/ws-updaters.ts b/packages/core/issues/ws-updaters.ts
index 48ea33c787..7c44b1bd23 100644
--- a/packages/core/issues/ws-updaters.ts
+++ b/packages/core/issues/ws-updaters.ts
@@ -496,7 +496,12 @@ export function onIssueUpdated(
// stale keys for the drift a patch cannot fix (enter/leave beyond the
// loaded window, undecidable membership, off-screen bucket counts). The
// server has already committed, so stale keys are flushed immediately.
- const change = applyIssueChange(qc, wsId, issue.id, issue, {
+ // A broadcast's blocked_by is not this reader's view: the server drops
+ // cross-project private blockers and fills the rest with the writer's
+ // access. Keep the cached list; a blocker change refetches it
+ // (blockers_changed).
+ const { blocked_by: _broadcastBlockers, ...patch } = issue;
+ const change = applyIssueChange(qc, wsId, issue.id, patch, {
changed,
baseIssue: cachedIssue,
acceptCurrent: (current) =>
@@ -526,7 +531,7 @@ export function onIssueUpdated(
(issue.revision === undefined ||
c.revision === undefined ||
issue.revision > c.revision)
- ? { ...c, ...issue }
+ ? { ...c, ...patch }
: c,
),
);