Fix first: memoize your message component.

```tsx
import { memo } from 'react';
export default memo(ChatMessage);
```

1. Wrap the message component in memo.
2. Re-run with the long gpt-4o response. Expected: no more 'Maximum update depth exceeded'; the UI stops hanging.

When to use: useCompletion from the AI SDK on a long gpt-4o response in streaming mode hangs the UI with 'Maximum update depth exceeded'.

When not to use: other render errors (different causes).

Compatibility: AI SDK (useCompletion), Next.js, React. Reported in vercel/ai#1610.

Variants:
- "useCompletion Maximum update depth exceeded"
- "useCompletion long response hang"
- "ai 1610"

Root cause: the hook updates completion state very fast; the unmemoized component re-renders recursively and blows the update depth.

Edge cases: this only bites on long responses, where the update pace is high enough to recurse.