Skip to content
Snippets Groups Projects
Unverified Commit b7e1dd38 authored by Aleksander Nicacio da Silva's avatar Aleksander Nicacio da Silva Committed by GitHub
Browse files

fix: VoIP not invalidating cache on permission change (#34102)

parent 94aa6af8
No related branches found
No related tags found
No related merge requests found
---
"@rocket.chat/ui-voip": patch
---
Fixes an issue preventing VoIP permission updates from being properly reflected in the UI.
import { useUser, useEndpoint, useSetting } from '@rocket.chat/ui-contexts';
import { useUser, useEndpoint } from '@rocket.chat/ui-contexts';
import { useQuery } from '@tanstack/react-query';
import { useEffect, useRef } from 'react';
import VoipClient from '../lib/VoipClient';
import { useWebRtcServers } from './useWebRtcServers';
import VoipClient from '../lib/VoipClient';
type VoipClientParams = {
enabled?: boolean;
......@@ -17,7 +17,6 @@ type VoipClientResult = {
export const useVoipClient = ({ enabled = true, autoRegister = true }: VoipClientParams = {}): VoipClientResult => {
const { _id: userId } = useUser() || {};
const isVoipEnabled = useSetting('VoIP_TeamCollab_Enabled', false);
const voipClientRef = useRef<VoipClient | null>(null);
const getRegistrationInfo = useEndpoint('GET', '/v1/voip-freeswitch.extension.getRegistrationInfoByUserId');
......@@ -25,7 +24,7 @@ export const useVoipClient = ({ enabled = true, autoRegister = true }: VoipClien
const iceServers = useWebRtcServers();
const { data: voipClient, error } = useQuery<VoipClient | null, Error>(
['voip-client', isVoipEnabled, userId, iceServers],
['voip-client', enabled, userId, iceServers],
async () => {
if (voipClientRef.current) {
voipClientRef.current.clear();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment