GeezerVison is showing github.com — fix(app): filter non-renderable part types from browser store (#18926) · msis/opencode@431e058
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/app/src/context/global-sync/event-reducer.ts +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -15,6 +15,8 @@ import type { State, VcsCache } from "./types" | 15 | 15 | import { trimSessions } from "./session-trim" | 16 | 16 | import { dropSessionCaches } from "./session-cache" | 17 | 17 |
| | 18 | +const SKIP_PARTS = new Set(["patch", "step-start", "step-finish"]) | | 19 | + | 18 | 20 | export function applyGlobalEvent(input: { | 19 | 21 | event: { type: string; properties?: unknown } | 20 | 22 | project: Project[] | @@ -211,6 +213,7 @@ export function applyDirectoryEvent(input: { | 211 | 213 | } | 212 | 214 | case "message.part.updated": { | 213 | 215 | const part = (event.properties as { part: Part }).part | | 216 | + if (SKIP_PARTS.has(part.type)) break | 214 | 217 | const parts = input.store.part[part.messageID] | 215 | 218 | if (!parts) { | 216 | 219 | input.setStore("part", part.messageID, [part]) | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/context/sync.tsx +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -14,6 +14,8 @@ import { useSDK } from "./sdk" | 14 | 14 | import type { Message, Part } from "@opencode-ai/sdk/v2/client" | 15 | 15 | import { SESSION_CACHE_LIMIT, dropSessionCaches, pickSessionCacheEvictions } from "./global-sync/session-cache" | 16 | 16 |
| | 17 | +const SKIP_PARTS = new Set(["patch", "step-start", "step-finish"]) | | 18 | + | 17 | 19 | function sortParts(parts: Part[]) { | 18 | 20 | return parts.filter((part) => !!part?.id).sort((a, b) => cmp(a.id, b.id)) | 19 | 21 | } | @@ -336,7 +338,8 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({ | 336 | 338 | batch(() => { | 337 | 339 | input.setStore("message", input.sessionID, reconcile(message, { key: "id" })) | 338 | 340 | for (const p of next.part) { | 339 | | - input.setStore("part", p.id, p.part) | | 341 | + const filtered = p.part.filter((x) => !SKIP_PARTS.has(x.type)) | | 342 | + if (filtered.length) input.setStore("part", p.id, filtered) | 340 | 343 | } | 341 | 344 | setMeta("limit", key, message.length) | 342 | 345 | setMeta("cursor", key, next.cursor) | |
|