Skip to content

Update toast fix#1445

Merged
yujonglee merged 2 commits intomainfrom
update-toast-fix
Sep 3, 2025
Merged

Update toast fix#1445
yujonglee merged 2 commits intomainfrom
update-toast-fix

Conversation

@duckduckhero
Copy link
Contributor

@yujonglee
pls take a look

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 3, 2025

📝 Walkthrough

Walkthrough

Re-enables meeting-aware gating in OTA toast to suppress update notifications during active/paused sessions and increases the update check interval to 3 minutes. Relocates Notifications rendering from the app shell’s outer fragment into the main content branch without changing gating conditions.

Changes

Cohort / File(s) Summary
OTA toast gating and polling
apps/desktop/src/components/toast/ota.tsx
Re-imports and uses ongoing session context; early-returns when status is running_active/running_paused; increases refetchInterval from 60s to 180s.
Notifications render location
apps/desktop/src/routes/app.tsx
Moves {showNotifications && <Notifications />} into the isMain branch after IndividualizationModal; removes outer rendering; gating condition unchanged.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant App
  participant OTA Toast
  participant SessionCtx as OngoingSession Context
  participant Updater as OTA Update Query

  App->>OTA Toast: Render
  OTA Toast->>SessionCtx: useOngoingSession()
  SessionCtx-->>OTA Toast: { status, sessionId }

  alt status in {running_active, running_paused}
    OTA Toast-->>App: Skip showing update toast
  else
    OTA Toast->>Updater: Poll update (refetch every 3 min)
    Updater-->>OTA Toast: Update available?
    alt Update available
      OTA Toast-->>App: Show update toast
    else
      OTA Toast-->>App: No toast
    end
  end
Loading
sequenceDiagram
  autonumber
  participant Router as App Router
  participant Shell as App Layout
  participant Main as Main Content Branch
  participant Notifs as Notifications

  Router->>Shell: Render app
  alt isMain && !isOnboardingNeeded
    Shell->>Main: Render EditModeProvider + content
    Main->>Notifs: Render Notifications inside main branch
  else
    Shell-->>Router: No Notifications rendered
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-toast-fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/desktop/src/components/toast/ota.tsx (1)

104-115: Unify environment checks to use import.meta.env in apps/desktop
Replace all process.env.NODE_ENV checks in the Vite/Tauri desktop app with the corresponding import.meta.env.PROD or import.meta.env.DEV flags to align with project-wide convention.

• In apps/desktop/src/components/toast/ota.tsx (L107), change process.env.NODE_ENV === "production"import.meta.env.PROD
• In apps/desktop/src/routes/__root.tsx (L39, L115, L125), change process.env.NODE_ENV !== "production" / === "production"import.meta.env.DEV / import.meta.env.PROD

🧹 Nitpick comments (3)
apps/desktop/src/components/toast/ota.tsx (3)

13-13: Narrow the selector to avoid unnecessary re-renders and unused fields.

Only status is used; selecting sessionId causes extra updates.

-  const ongoingSession = useOngoingSession((state) => ({
-    status: state.status,
-    sessionId: state.sessionId,
-  }));
+  const ongoingStatus = useOngoingSession((s) => s.status);
-    if (ongoingSession.status === "running_active" || ongoingSession.status === "running_paused") {
+    if (ongoingStatus === "running_active" || ongoingStatus === "running_paused") {

Also applies to: 90-93, 129-131


113-115: Optional: pause polling during meetings to save cycles.

If prefetching during meetings isn’t required, gate the query via enabled.

   const checkForUpdate = useQuery({
@@
-    refetchInterval: 1000 * 60 * 3,
+    refetchInterval: 1000 * 60 * 3,
+    enabled: ongoingStatus !== "running_active" && ongoingStatus !== "running_paused",
     refetchIntervalInBackground: true,
   });

137-194: DRY: reuse handleUpdateInstall for the Update Now action.

Avoid duplicating the install/download UI logic.

-          onClick: async () => {
-            sonnerToast.dismiss("ota-notification");
-            const updateChannel = new Channel<number>();
-            let totalDownloaded = 0;
-            let contentLength: number | undefined;
-            toast({
-              id: "update-download",
-              title: `Downloading Update ${update.version}`,
-              content: (
-                <div className="space-y-1">
-                  <div>This may take a while...</div>
-                  <DownloadProgress channel={updateChannel} />
-                </div>
-              ),
-              dismissible: false,
-            });
-            update.downloadAndInstall((progressEvent) => {
-              if (progressEvent.event === "Started") {
-                totalDownloaded = 0;
-                contentLength = progressEvent.data.contentLength;
-              } else if (progressEvent.event === "Progress") {
-                totalDownloaded += progressEvent.data.chunkLength;
-                const totalSize = contentLength || (50 * 1024 * 1024);
-                const progressPercentage = Math.min(Math.round((totalDownloaded / totalSize) * 100), 99);
-                updateChannel.onmessage(progressPercentage);
-              } else if (progressEvent.event === "Finished") {
-                updateChannel.onmessage(100);
-              }
-            }).then(() => {
-              message("The app will now restart", { kind: "info", title: "Update Installed" });
-              setTimeout(relaunch, 2000);
-            }).catch((err: any) => {
-              Sentry.captureException(err);
-              if (!appInApplicationsFolder.data) {
-                message("Please move the app to the Applications folder and try again", {
-                  kind: "error",
-                  title: "Update Installation Failed",
-                });
-              } else {
-                message(err, { kind: "error", title: "Update Installation Failed" });
-              }
-            });
-          },
+          onClick: () => handleUpdateInstall(update, "ota-notification", !!appInApplicationsFolder.data),
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c021b21 and 088566f.

📒 Files selected for processing (2)
  • apps/desktop/src/components/toast/ota.tsx (2 hunks)
  • apps/desktop/src/routes/app.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}

⚙️ CodeRabbit configuration file

**/*.{js,ts,tsx,rs}: 1. Do not add any error handling. Keep the existing one.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".

Files:

  • apps/desktop/src/routes/app.tsx
  • apps/desktop/src/components/toast/ota.tsx
🧬 Code graph analysis (1)
apps/desktop/src/routes/app.tsx (1)
apps/desktop/src/components/toast/index.tsx (1)
  • Notifications (5-13)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: ci (macos, macos-14)
  • GitHub Check: ci (windows, windows-latest)
🔇 Additional comments (1)
apps/desktop/src/routes/app.tsx (1)

176-176: LGTM: Notifications moved under OngoingSessionProvider.

This ensures the OTA toast can read meeting status via context; gating remains unchanged.

@yujonglee yujonglee merged commit aadfd2c into main Sep 3, 2025
11 checks passed
@yujonglee yujonglee deleted the update-toast-fix branch September 3, 2025 23:23
@coderabbitai coderabbitai bot mentioned this pull request Sep 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants