Skip to content

Conversation

@thomasyuill-livekit
Copy link
Contributor

@thomasyuill-livekit thomasyuill-livekit commented Dec 1, 2025

Issue

https://linear.app/livekit/issue/CLT-2313/remove-useconnection-from-agent-starter-react

Context
#298 (comment)

Summary

Removes custom useConnection hook and simplifies session management by using LiveKit's built-in useSessionContext directly. Also migrates theme management to next-themes library.

Key Changes

  • Remove custom connection layer: Replaced useConnection hook and ConnectionProvider with direct usage of useSessionContext from @livekit/components-react
  • Simplify session state: Use built-in isConnected, start(), and end() methods instead of custom isConnectionActive and transition handlers
  • Migrate theme management: Replaced custom theme implementation with next-themes library for better maintainability
  • Clean up components: Updated AgentControlBar, SessionView, ViewController, and useAgentErrors to use simplified APIs
  • Remove UI showcase: Deleted example UI components page which would require a shared hook for leverging TokenSource

Benefits

  • Less custom code to maintain
  • Leverages standard LiveKit patterns
  • Simpler, more predictable connection state management

Side effect

  • Video avatar will not fade-out on disconnecting as the video stream will end abruptly before the exit transition has completed

@vercel
Copy link

vercel bot commented Dec 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
sandbox-voice-assistant Ready Ready Preview Dec 1, 2025 6:51pm

@thomasyuill-livekit thomasyuill-livekit self-assigned this Dec 1, 2025
@thomasyuill-livekit thomasyuill-livekit force-pushed the thomasyuill/clt-2313-remove-useconnection-from-agent-starter-react branch from ba43b2e to 5c56f9d Compare December 1, 2025 15:09
@thomasyuill-livekit thomasyuill-livekit changed the title chore: remove useConnectio for useSessionContext chore: remove useConnection for useSessionContext Dec 1, 2025
@thomasyuill-livekit thomasyuill-livekit force-pushed the thomasyuill/clt-2313-remove-useconnection-from-agent-starter-react branch from 5c56f9d to 357a1e8 Compare December 1, 2025 15:14
@thomasyuill-livekit thomasyuill-livekit force-pushed the thomasyuill/clt-2313-remove-useconnection-from-agent-starter-react branch from 357a1e8 to 50a44b6 Compare December 1, 2025 15:16
Copy link
Contributor

@lukasIO lukasIO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@thomasyuill-livekit thomasyuill-livekit merged commit 75e893e into main Dec 2, 2025
5 checks passed
@thomasyuill-livekit thomasyuill-livekit deleted the thomasyuill/clt-2313-remove-useconnection-from-agent-starter-react branch December 2, 2025 17:24
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.

4 participants