Skip to content

Commit ede22dd

Browse files
committed
chores
1 parent 5ee3a7e commit ede22dd

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

apps/desktop/src/components/shared/permission-row.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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">

apps/desktop/src/contexts/listener.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff 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
};

apps/desktop/src/hooks/use-permissions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)