Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apps/desktop/src/routes/editor/ShareButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ function ShareButton() {
mutationFn: async () => {
setUploadState({ type: "idle" });

if (!navigator.onLine) {
Comment thread
shashank-sn marked this conversation as resolved.
await commands.globalMessageDialog(
"You appear to be offline. Please check your internet connection and try again.",
);
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor gotcha: this return makes the mutation resolve successfully. If any UI behavior is keyed off mutation state (e.g. !upload.isIdle), you can end up flashing the upload/progress UI even though nothing started.

Might be cleaner to do the offline guard before calling upload.mutate() so the mutation stays idle, or to otherwise avoid treating “offline” as a successful mutation.

}
Comment on lines +32 to +37

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block looks like it accidentally includes an extra } and (due to indentation) will always run the dialog/throw even when online. If the intent is to short-circuit when offline (and avoid the onError dialog), return early after showing the message.

Suggested change
if (!navigator.onLine) {
throw new Error(
"You appear to be offline. Please check your internet connection and try again.",
);
}
await commands.globalMessageDialog(
"You appear to be offline. Please check your internet connection and try again.",
);
throw new Error("No internet connection");
}
if (!navigator.onLine) {
await commands.globalMessageDialog(
"You appear to be offline. Please check your internet connection and try again.",
);
return;
}


console.log("Starting upload process...");

// Check authentication first
Expand Down
8 changes: 8 additions & 0 deletions apps/desktop/src/routes/recordings-overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
);
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same pattern here: returning after the dialog counts as a successful mutation, so onSuccess will still run and trigger recordingMeta.refetch() while offline.

Worth guarding onSuccess (or moving the offline check before calling the mutation) so the offline path doesn’t accidentally kick off extra work / error UI.

}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Offline Error Reaches Global Dialog

When an offline user clicks upload in the overlay, this branch first shows the clear offline dialog and then throws a normal error. This mutation has no local onError, so the app-wide mutation handler opens a second native dialog like Error\nError: No internet connection, which keeps the generic error popup on the new offline path.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/routes/recordings-overlay.tsx
Line: 728

Comment:
**Offline Error Reaches Global Dialog**

When an offline user clicks upload in the overlay, this branch first shows the clear offline dialog and then throws a normal error. This mutation has no local `onError`, so the app-wide mutation handler opens a second native dialog like `Error\nError: No internet connection`, which keeps the generic error popup on the new offline path.

How can I resolve this? If you propose a fix, please make it concise.


// Check authentication first
const existingAuth = await authStore.get();
if (!existingAuth) {
Expand Down