components-js
components-js copied to clipboard
Prevent crash when `settings` control is enabled in `ControlBar`
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.
🦋 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
I actually noticed that this also happens with other properties like chat. I will look into whether other appropriate fixes might be available later.