This message was deleted.
# helpdesk
s
This message was deleted.
b
Clicking the 'disconnect' button rerenders the component like 5-20 times and eventually sets both values to 'false' (usually videoEnabled is switched first). Something funky is going on here
Internally, the Camera and Audio toggle buttons use TrackToggle. I'm not sure if they're the cause of this issue, but these two spots seem suspect to me: // useTrackToggle.ts const enabled = useObservableState(enabledObserver, initialState ?? !!track?.isEnabled); // TrackPublication.ts get isEnabled(): boolean { return true; } Always returning 'true' seems like an oversight to me.
p
Hi, this got fixed recently and should work as expected in
v1.5.1
b
According to yarn.lock, we do have 1.5.1. Could these warnings (or rather their cause) disable the fix somehow?
warning " > @livekit/components-react@1.5.1" has incorrect peer dependency "livekit-client@^1.15.1". warning " > @livekit/components-react@1.5.1" has incorrect peer dependency "react@>=18". warning " > @livekit/components-react@1.5.1" has incorrect peer dependency "react-dom@>=18". warning " > @livekit/components-react@1.5.1" has unmet peer dependency "tslib@^2.6.2". warning "@livekit/components-react > @livekit/components-core@0.8.2" has incorrect peer dependency "livekit-client@^1.15.1". warning "@livekit/components-react > @livekit/components-core@0.8.2" has unmet peer dependency "tslib@^2.6.2".
p
definitely makes sense to update livekit-client, too
b
Ah. The fix seems to be inside the prefab ControlBar component; we use our own custom one. But it should be easy to replicate it
p
ah, yeah, that makes sense
b
Even though it does not use useTrackToggle, clicking our disconnect button still prints 'user click: true' from this handler (which I copied from the fix to prefab ControlBar):
const cameraOnChange = useCallback( (enabled: boolean, isUserInitiated: boolean) => { console.log('enabled: ', enabled) console.log('user click: ', isUserInitiated) if (isUserInitiated) saveVideoInputEnabled(enabled) }, [saveVideoInputEnabled], )
'enabled' is also 'false' here, which explains the reset issue on disconnect
p
cc @eager-zoo-16408
b
our Disconnect button uses useDisconnectButton, and receives no props at all (so no onClick handler)
Same happens for the audio handler: called with false when clicking disconnect button
It figures ofc, since it too uses useTrackToggle
p
are you spreading the html props that get returned from useTrackToggle on your custom implementation button ?
b
Yes. I was just beginning to think that might be the issue
p
I think I see a potential issue in our code
b
What kind of issue? I'm trying to figure out how the wrong onClick method could fire, but so far I can only think that the className on our custom component could be the cause somehow. Here is our component, for reference:
import styled from 'styled-components' const Button = styled.button` .md-icon { color: #fff; font-size: 28px; } ` function ControlButton(props) { return ( <Button className="lk-button" {...props}> {props.children} </Button> ) } export default ControlButton
p
are you calling the
toggle
function somewhere else, too?
b
As far as I can tell, we don't call it anywhere
p
hm. could you provide a minimal reproduction repository?
b
I'm not sure how to do it, given all the stuff that we use... I can ask my colleague, who did most of the implementation, but it will have to wait until Monday
p
sure, no rush. thanks!
b
FWIW, I tried changing the className, but it didn't help. so the issue is likely with the toggle function. I'll get back to you on Monday
👍 1
My colleague is investigating this now; will report back with any results
Update: in the end, we 'resolved' this issue by removing the option to persist the settings; we now take them from meeting-type-specific defaults instead. This was better for our use-case anyway, so we likely won't spend more time on this, unfortunately
👍 1