Skip to content

Conversation

haslinghuis
Copy link
Member

@haslinghuis haslinghuis commented Aug 26, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Fixed the display of network downlink speed (Mbps) in the network status panel, ensuring the correct value is shown consistently.
    • Resolved a case mismatch that could cause incorrect readings or occasional runtime errors when viewing network details.
    • Other network status fields (status, type, RTT) are unaffected.
    • Improves stability and reliability of the network status view across supported browsers and devices.

@haslinghuis haslinghuis added this to the 11.0 milestone Aug 26, 2025
@haslinghuis haslinghuis self-assigned this Aug 26, 2025
Copy link
Contributor

coderabbitai bot commented Aug 26, 2025

Walkthrough

A single fix in src/js/tabs/setup.js updates the network status rendering to reference downlink (lowercase) instead of downLink, aligning with the actual property used for Mbps display. No public APIs or exports were modified.

Changes

Cohort / File(s) Summary
Network status UI rendering
src/js/tabs/setup.js
Corrected property name from downLink to downlink when rendering network downlink Mbps; other fields (status, type, RTT) unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • 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 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

@haslinghuis haslinghuis moved this to App in 2025.12.0 Aug 26, 2025
@haslinghuis haslinghuis requested a review from VitroidFPV August 26, 2025 20:51
Copy link
Contributor

Preview URL: https://f0fb65e3.betaflight-configurator.pages.dev

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: 0

Caution

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

⚠️ Outside diff range comments (2)
src/js/tabs/setup.js (2)

63-70: Correct the jQuery selector for default_btn

The selector "default_btn" targets a non-existent tag rather than the .default_btn class. Confirmed via searching the HTML templates that elements are marked up as <div class="default_btn">. Update both occurrences in src/js/tabs/setup.js to properly disable the button container.

• src/js/tabs/setup.js, around line 63
• src/js/tabs/setup.js, around line 67

Apply this diff:

-            $("default_btn").addClass("disabled");
+            $(".default_btn").addClass("disabled");
@@
-            $("default_btn").addClass("disabled");
+            $(".default_btn").addClass("disabled");

3-3: Rename helper file to match exported symbol

The helper file is named isExportModeEnabled.js but exports a function called isExpertModeEnabled. Although imports currently reference the file’s misspelled name and work at runtime, the mismatch between “Export” (file) and “Expert” (symbol) is confusing and should be fixed.

Please refactor as follows:

  • Rename
    src/js/utils/isExportModeEnabled.js

    src/js/utils/isExpertModeEnabled.js
  • Update all import statements accordingly:
    • In src/js/tabs/setup.js
      - import { isExpertModeEnabled } from "../utils/isExportModeEnabled";
      + import { isExpertModeEnabled } from "../utils/isExpertModeEnabled";
    • In src/js/tabs/onboard_logging.js
      - import { isExpertModeEnabled } from "../utils/isExportModeEnabled";
      + import { isExpertModeEnabled } from "../utils/isExpertModeEnabled";
    • In src/js/main.js
      - import { isExpertModeEnabled } from "./utils/isExportModeEnabled.js";
      + import { isExpertModeEnabled } from "./utils/isExpertModeEnabled.js";
    • In src/js/TuningSliders.js
      - import { isExpertModeEnabled } from "./utils/isExportModeEnabled";
      + import { isExpertModeEnabled } from "./utils/isExpertModeEnabled";

This will align the file name with its exported symbol and improve code clarity.

🧹 Nitpick comments (2)
src/js/tabs/setup.js (2)

500-517: Guard against falsy numeric values and improve display formatting for network metrics.

Current use of || "Unknown" turns legitimate values like 0 into "Unknown". Also, always appending units yields "Unknown Mbps/ms". Prefer nullish coalescing and format only when numeric. While here, note that effectiveType never equals "none"; that check is redundant.

Apply this small, local refactor:

-    const type = connection?.effectiveType || "Unknown";
-    const downlink = connection?.downlink || "Unknown";
-    const rtt = connection?.rtt || "Unknown";
+    const type = connection?.effectiveType ?? "Unknown";
+    const downlink = connection?.downlink ?? "Unknown";
+    const rtt = connection?.rtt ?? "Unknown";
@@
-    $(".network-downlink").text(`${downlink} Mbps`);
-    $(".network-rtt").text(`${rtt} ms`);
+    $(".network-downlink").text(typeof downlink === "number" ? `${downlink.toFixed(2)} Mbps` : "Unknown");
+    $(".network-rtt").text(typeof rtt === "number" ? `${rtt} ms` : "Unknown");

Optional (nit): You can drop || type === "none" in Line 505 since effectiveType is one of "slow-2g" | "2g" | "3g" | "4g". Keeping it doesn’t break anything, it’s just unreachable with effectiveType.


525-527: Keep network status live by listening to connectivity changes.

Right now showNetworkStatus() runs once on tab init. Hooking to online/offline and Network Information API change events will keep the UI accurate without adding a polling loop.

         showFirmwareInfo();
         showNetworkStatus();
+
+        // Keep network status updated reactively
+        window.addEventListener("online", showNetworkStatus);
+        window.addEventListener("offline", showNetworkStatus);
+        if (navigator.connection?.addEventListener) {
+            navigator.connection.addEventListener("change", showNetworkStatus);
+        }
📜 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 4e0fb3a and f0fb65e.

📒 Files selected for processing (1)
  • src/js/tabs/setup.js (1 hunks)
🔇 Additional comments (1)
src/js/tabs/setup.js (1)

515-515: Correct property fix (Network Information API) — good catch.

Using connection.downlink (lowercase) is the correct property; this prevents "undefined Mbps" renderings and potential runtime surprises.

@haslinghuis haslinghuis merged commit 37776e4 into betaflight:master Aug 26, 2025
7 checks passed
@haslinghuis haslinghuis deleted the fix-typo branch August 26, 2025 20:57
@github-project-automation github-project-automation bot moved this from App to Done in 2025.12.0 Aug 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants