Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: show clear offline message when share/upload button clicked without internet

shashank-sn149448667f50
diff --git a/apps/desktop/src/routes/editor/ShareButton.tsx b/apps/desktop/src/routes/editor/ShareButton.tsx
index bebe10b5a..9a29c64c7 100644
--- a/apps/desktop/src/routes/editor/ShareButton.tsx
+++ b/apps/desktop/src/routes/editor/ShareButton.tsx
@@ -29,6 +29,13 @@ function ShareButton() {
mutationFn: async () => {
setUploadState({ type: "idle" });
+ if (!navigator.onLine) {
+ await commands.globalMessageDialog(
+ "You appear to be offline. Please check your internet connection and try again.",
+ );
+ throw new Error("No internet connection");
+ }
+
console.log("Starting upload process...");
// Check authentication first
diff --git a/apps/desktop/src/routes/recordings-overlay.tsx b/apps/desktop/src/routes/recordings-overlay.tsx
index ab0a71a1a..a52e6f931 100644
--- a/apps/desktop/src/routes/recordings-overlay.tsx
+++ b/apps/desktop/src/routes/recordings-overlay.tsx
@@ -719,6 +719,14 @@ function createRecordingMutations(
return;
}
+ // Check connectivity first — prevent hanging on network calls when offline
+ if (!navigator.onLine) {
+ await commands.globalMessageDialog(
+ "You appear to be offline. Please check your internet connection and try again.",
+ );
+ throw new Error("No internet connection");
+ }
+
// Check authentication first
const existingAuth = await authStore.get();
if (!existingAuth) {