Skip to content

Commit 8092afe

Browse files
perf(web): notification settings compile with the React Compiler
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 41552fb commit 8092afe

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎apps/web/reactCompiledFiles.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,5 @@ export const REACT_COMPILED_FILES = [
7979
"apps/web/src/components/settings/useHostConnectionChecks.ts",
8080
"apps/web/src/components/settings/useProjectScriptSettings.ts",
8181
"apps/web/src/components/settings/SnapShotSetupDialog.tsx",
82+
"apps/web/src/components/settings/NotificationSettings.tsx",
8283
] as const;

‎apps/web/src/components/settings/NotificationSettings.tsx‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { settlePromise } from "@t3tools/client-runtime/state/runtime";
12
import { useState } from "react";
23

34
import {
@@ -46,21 +47,19 @@ export function NotificationSettings() {
4647
return;
4748
}
4849
setRequesting(true);
49-
try {
50-
const permission = await Notification.requestPermission();
51-
if (permission !== "granted") {
52-
setPermissionMessage(
53-
"Allow notifications in your browser or system settings, then choose this option again. Sound only is still available.",
54-
);
55-
return;
56-
}
57-
} catch {
50+
const permission = await settlePromise(() => Notification.requestPermission());
51+
setRequesting(false);
52+
if (permission._tag === "Failure") {
5853
setPermissionMessage(
5954
"Notifications are unavailable in this browser. Sound only is still available.",
6055
);
6156
return;
62-
} finally {
63-
setRequesting(false);
57+
}
58+
if (permission.value !== "granted") {
59+
setPermissionMessage(
60+
"Allow notifications in your browser or system settings, then choose this option again. Sound only is still available.",
61+
);
62+
return;
6463
}
6564
}
6665
updateSettings({ notificationMode: value });

0 commit comments

Comments
 (0)