Skip to content

Commit c091143

Browse files
committed
fix(app): validate session_diff is array in session-side-panel
The frontend may have cached malformed data where session_diff is not an array. Changed from using ?? [] (which only handles null/undefined) to Array.isArray validation to handle any non-array cached data. Fixes anomalyco#19270
1 parent 5f12487 commit c091143

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎packages/app/src/pages/session/session-side-panel.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ export function SessionSidePanel(props: {
5555
const treeWidth = createMemo(() => (fileOpen() ? `${layout.fileTree.width()}px` : "0px"))
5656

5757
const info = createMemo(() => (params.id ? sync.session.get(params.id) : undefined))
58-
const diffs = createMemo(() => (params.id ? (sync.data.session_diff[params.id] ?? []) : []))
58+
const diffs = createMemo(() => {
59+
const raw = params.id ? sync.data.session_diff[params.id] : undefined
60+
return Array.isArray(raw) ? raw : []
61+
})
5962
const reviewCount = createMemo(() => Math.max(info()?.summary?.files ?? 0, diffs().length))
6063
const hasReview = createMemo(() => reviewCount() > 0)
6164
const diffsReady = createMemo(() => {

0 commit comments

Comments
 (0)