File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ export function PermissionRow({
9292 isAuthorized ? "bg-blue-100" : "bg-neutral-50" ,
9393 ] ) }
9494 >
95- < div className = { cn ( isAuthorized ? "text-blue-600" : "text-neutral-500" ) } > { icon } </ div >
95+ < div className = { cn ( [ isAuthorized ? "text-blue-600" : "text-neutral-500" ] ) } > { icon } </ div >
9696 </ div >
9797 ) }
9898 < div className = "min-w-0 flex-1" >
Original file line number Diff line number Diff line change @@ -76,10 +76,12 @@ const useHandleMuteAndStop = (store: ListenerStore) => {
7676
7777 useEffect ( ( ) => {
7878 let unlisten : ( ( ) => void ) | undefined ;
79+ let cancelled = false ;
80+ let notificationTimerId : ReturnType < typeof setTimeout > ;
7981
8082 detectEvents . detectEvent . listen ( ( { payload } ) => {
8183 if ( payload . type === "micStarted" ) {
82- setTimeout ( ( ) => {
84+ notificationTimerId = setTimeout ( ( ) => {
8385 notificationCommands . showNotification ( {
8486 key : payload . key ,
8587 title : "Mic Started" ,
@@ -94,11 +96,21 @@ const useHandleMuteAndStop = (store: ListenerStore) => {
9496 setMuted ( payload . value ) ;
9597 }
9698 } ) . then ( ( fn ) => {
97- unlisten = fn ;
99+ if ( cancelled ) {
100+ fn ( ) ;
101+ } else {
102+ unlisten = fn ;
103+ }
104+ } ) . catch ( ( err ) => {
105+ console . error ( "Failed to setup detect event listener:" , err ) ;
98106 } ) ;
99107
100108 return ( ) => {
109+ cancelled = true ;
101110 unlisten ?.( ) ;
111+ if ( notificationTimerId ) {
112+ clearTimeout ( notificationTimerId ) ;
113+ }
102114 } ;
103115 } , [ stop , setMuted ] ) ;
104116} ;
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ export function usePermissions() {
1111 queryFn : ( ) => permissionsCommands . checkMicrophonePermission ( ) ,
1212 refetchInterval : 1000 ,
1313 select : ( result ) => {
14- console . log ( result ) ;
1514 if ( result . status === "error" ) {
1615 throw new Error ( result . error ) ;
1716 }
You can’t perform that action at this time.
0 commit comments