Skip to content

fix(web): bump @assistant-ui/react to ^0.14.22 — fixes session-view crash - #299

Merged
nikhilunni merged 1 commit into
mainfrom
fix/assistant-ui-viewport-hooks-crash
Jun 15, 2026
Merged

nikhilunni merged 1 commit into
mainfrom
fix/assistant-ui-viewport-hooks-crash

Conversation

@nikhilunni

Copy link
Copy Markdown
Contributor

Bug

Clicking into any session crashes the whole view (CatchBoundary) with:

TypeError: Cannot read properties of undefined (reading 'length')
  at areHookInputsEqual (react-dom)
  at useOnScrollToBottom → useThreadViewportAutoScroll
  at ThreadPrimitive.ViewportScrollable

Live on main (and prod) right now — fires on session-click regardless of session data.

Root cause

A Rules-of-Hooks violation inside @assistant-ui/react: hook #27 in ThreadPrimitive.ViewportScrollable flips between useCallback and useEffect across renders, so React's areHookInputsEqual reads .length of an undefined deps array (same mechanism as react/react#18372).

Introduced by the dependabot bump in #248 (0.14.14 → 0.14.20). The regression window is 0.14.19–0.14.20, where assistant-ui added React Compiler precompilation — which emitted the conditionally-present hook. Fixed upstream in 0.14.21+.

Fix

Bump @assistant-ui/react ^0.14.20 → ^0.14.22 (latest; resolves to 0.14.22). tsc clean, full web vitest suite 52/52 green, no API breakage.

On a regression test

I dug into this — jsdom cannot catch this class of bug. The existing SessionThread.test.tsx already mounts the real <Thread/>/ViewportScrollable, yet it passes on the broken 0.14.20 (verified), because jsdom never performs the layout/scroll re-render that triggers the hook-order flip. A real regression guard requires browser-based testing (headless Chromium) — the right home is the planned web/e2e Playwright net (ADR 0051 prep step), not new infra bolted on here. Flagging rather than standing that up in a hotfix.

🤖 Generated with Claude Code

…rash

Clicking a session crashed the whole view with
`TypeError: Cannot read properties of undefined (reading 'length')`
(at React's areHookInputsEqual). Root cause: a Rules-of-Hooks violation
inside assistant-ui's `useThreadViewportAutoScroll` → `useOnScrollToBottom`
(`ThreadPrimitive.ViewportScrollable`) — hook #27 flips between useCallback
and useEffect across renders, so React reads `.length` of an undefined deps
array (cf. react/react#18372).

Introduced by the dep bump in #248 (0.14.14 → 0.14.20); the regression window
is 0.14.19–0.14.20, where assistant-ui added React Compiler precompilation
(which emitted the conditional hook). Fixed upstream by 0.14.21+.

Note: this only reproduces in a real browser — jsdom never performs the
layout/scroll re-render that triggers the hook-order flip, so the existing
vitest render test passes on the broken version (verified). A real regression
guard needs browser-based testing (the planned web/e2e Playwright net).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nikhilunni
nikhilunni merged commit fe3c2b3 into main Jun 15, 2026
14 checks passed
@nikhilunni
nikhilunni deleted the fix/assistant-ui-viewport-hooks-crash branch June 15, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant