components-js icon indicating copy to clipboard operation
components-js copied to clipboard

Prevent crash when `settings` control is enabled in `ControlBar`

Open smorimoto opened this issue 4 months ago • 3 comments

The ControlBar component would crash when settings: true was set in the controls prop, despite being defined in the type definition. This occurred because the SettingsMenuToggle component was using useLayoutContext() which throws an error when no LayoutContext is provided.

Changed useLayoutContext() to useMaybeLayoutContext() in the useSettingsToggle hook to gracefully handle cases where LayoutContext is not available, preventing the crash and allowing the settings control to work properly.

smorimoto avatar Jul 02 '25 07:07 smorimoto

🦋 Changeset detected

Latest commit: 71934491b2941aba691ecbabe3c5c5c55ba8294d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@livekit/components-react Patch
@livekit/component-example-next Patch
@livekit/components-js-docs Patch
@livekit/component-docs-storybook Patch
@livekit/components-docs-gen Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Jul 02 '25 07:07 changeset-bot[bot]

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jul 02 '25 07:07 CLAassistant

I actually noticed that this also happens with other properties like chat. I will look into whether other appropriate fixes might be available later.

smorimoto avatar Jul 02 '25 08:07 smorimoto