Skip to content

Conversation

@haslinghuis
Copy link
Member

@haslinghuis haslinghuis commented Oct 3, 2025

Summary by CodeRabbit

  • New Features

    • Preserves your previously selected board after refreshing board/firmware lists.
  • Bug Fixes

    • Fixes issue where the selected board could reset or change unexpectedly after a refresh.
    • Ensures the selection change event fires correctly when the same board is reselected.
  • Improvements

    • More reliable loading of boards before updating the UI, reducing flicker and race-condition issues during refresh.
    • Smoother refresh experience when updating available boards and firmware.

@haslinghuis haslinghuis added this to the 2025.12 milestone Oct 3, 2025
@haslinghuis haslinghuis self-assigned this Oct 3, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 3, 2025

Walkthrough

Converted loadTargetList to async, updated call sites to await BuildApi.loadTargets, and added logic to capture and restore the previously selected board after the target list reloads, triggering a change event only when the prior selection still exists.

Changes

Cohort / File(s) Summary
Firmware Flasher UI logic
`src/js/tabs/firmware_flasher.js`
- Change: `loadTargetList` → async function
- Callers updated to `await self.buildApi.loadTargets()` before populating list
- Preserve/restore previously selected board; re-select and trigger change if still present
- Control flow adjusted to restore only after repopulation

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant FF as FirmwareFlasher
  participant BA as BuildApi

  U->>FF: Refresh board/firmware list
  FF->>FF: Capture currentlySelectedBoard
  FF->>BA: await loadTargets()
  BA-->>FF: targets
  FF->>FF: loadTargetList(targets)
  alt Previously selected exists
    FF->>FF: Re-select board
    FF-->>U: Emit change event
  else Not found
    FF->>FF: Keep default selection
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

Tested, RN: REFACTOR

Suggested reviewers

  • KarateBrot
  • VitroidFPV
  • nerdCopter

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning No pull request description was provided, so none of the required information from the repository’s description template is present. Please add a descriptive pull request description following the provided template, including a summary of changes, rationale, testing instructions, and any related issue references.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run `@coderabbitai generate docstrings` to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly describes addressing board clearance issues in the firmware flasher when switching releases, which aligns with the added logic for preserving and restoring the selected board.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b4bd4f3 and 851325e.

📒 Files selected for processing (1)
  • src/js/tabs/firmware_flasher.js (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-02T07:45:48.606Z
Learnt from: blckmn
PR: betaflight/betaflight-configurator#4583
File: src/js/tabs/firmware_flasher.js:949-961
Timestamp: 2025-09-02T07:45:48.606Z
Learning: In src/js/tabs/firmware_flasher.js, the config file loading code path after firmware loading (in the load_file click handler) cannot be reached when UF2 firmware is loaded, according to the maintainer blckmn. This code is maintained for backward compatibility with unified target settings and will be refactored in a future PR.

Applied to files:

  • src/js/tabs/firmware_flasher.js
🔇 Additional comments (1)
src/js/tabs/firmware_flasher.js (1)

460-469: Smart preservation of board selection

Capturing the prior board before the reload and restoring it (only when it still exists) saves users from re-selecting hardware every time build types change. Clean guard conditions too. Nicely done.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@haslinghuis haslinghuis moved this to App in 2025.12.0 Oct 3, 2025
@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 3, 2025

@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2025

Preview URL: https://pr4652.betaflight-app.pages.dev

Copy link
Member

@nerdCopter nerdCopter left a comment

Choose a reason for hiding this comment

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

fantastic!

@haslinghuis haslinghuis merged commit 6133a7b into betaflight:master Oct 3, 2025
7 checks passed
@github-project-automation github-project-automation bot moved this from App to Done in 2025.12.0 Oct 3, 2025
@haslinghuis haslinghuis deleted the fix-ff-board-clearance branch October 3, 2025 19:06
@coderabbitai coderabbitai bot mentioned this pull request Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants