Fix firmware badge shown for models without API data (#311)

Printers whose model has no firmware data in Bambu Lab's API (e.g. H2C
on public beta firmware) displayed a misleading green "up to date" badge.
The API returns latest_version=null for these models, so there is nothing
to compare against. Hide the badge when latest_version is not available.

- Add latest_version check to badge render condition in PrintersPage
- Add test for badge hidden when API returns no firmware data
This commit is contained in:
maziggy
2026-02-10 12:31:14 +01:00
parent a5706fe20a
commit 19289855de
5 changed files with 37 additions and 3 deletions
+1
View File
@@ -42,6 +42,7 @@ All notable changes to Bambuddy will be documented in this file.
- **H2D Pro Prints Fail at ~75% With Extrusion Motor Overload** ([#245](https://github.com/maziggy/bambuddy/issues/245)) — H2D Pro firmware interprets `use_ams: 1` (integer) as a nozzle index, routing filament to the deputy nozzle instead of the main nozzle. Bambu Studio sends `use_ams: true` (boolean) while using integers for other fields. Fixed by keeping `use_ams` as boolean for all printers including H2D series.
- **GitHub Backup Description Misleading** — The "App Settings" backup card said "excludes sensitive data" but the complete database is pushed. Updated description to "complete database."
- **Support Bundle Shows 0 AMS Units** — The support info always reported `ams_unit_count: 0` because it expected `raw_data["ams"]` to be a nested dict (`{"ams": [...]}`) but the MQTT handler stores it as a flat list. Now handles both formats.
- **Firmware Badge Shown for Models Without API Data** ([#311](https://github.com/maziggy/bambuddy/issues/311)) — Printers whose model has no firmware data in Bambu Lab's API (e.g. H2C on public beta firmware) showed a misleading green "up to date" badge. The badge is now hidden when the API returns no `latest_version`, since there is nothing to compare against.
### Documentation
- **Supported Printers Updated** — Updated README, website, and wiki to list all 12 supported Bambu Lab printer models: X1, X1C, X1E, P1P, P1S, P2S, A1, A1 Mini, H2D, H2D Pro, H2C, H2S. Removed outdated "Testers Needed" messaging and Tested/Needs Testing distinctions — all models are now uniformly listed as supported. Added H2C printer image to website. Added H2D Pro, H2C columns to wiki feature comparison tables and new P2 Series section.
@@ -274,5 +274,38 @@ describe('PrintersPage', () => {
expect(screen.queryByText('01.09.00.00')).not.toBeInTheDocument();
expect(screen.queryByText('01.08.00.00')).not.toBeInTheDocument();
});
it('hides badge when API has no firmware data for the model', async () => {
const firmwareNoData = {
printer_id: 1,
current_version: '01.01.03.00',
latest_version: null,
update_available: false,
download_url: null,
release_notes: null,
};
server.use(
http.get('/api/v1/firmware/updates/:id', () => {
return HttpResponse.json(firmwareNoData);
}),
http.get('/api/v1/settings/', () => {
return HttpResponse.json({
check_printer_firmware: true,
auto_archive: true,
save_thumbnails: true,
});
})
);
render(<PrintersPage />);
await waitFor(() => {
expect(screen.getByText('X1 Carbon')).toBeInTheDocument();
});
// Badge should not appear when API returns no latest_version
expect(screen.queryByText('01.01.03.00')).not.toBeInTheDocument();
});
});
});
+1 -1
View File
@@ -1992,7 +1992,7 @@ function PrinterCard({
</button>
)}
{/* Firmware Version Badge */}
{firmwareInfo?.current_version && (
{firmwareInfo?.current_version && firmwareInfo?.latest_version && (
<button
onClick={() => setShowFirmwareModal(true)}
className={`flex items-center gap-1 px-2 py-1 rounded-full text-xs hover:opacity-80 transition-opacity ${
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -23,7 +23,7 @@
<!-- Splash screens for iOS -->
<link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
<script type="module" crossorigin src="/assets/index-DKpTCC1_.js"></script>
<script type="module" crossorigin src="/assets/index-CbyBA630.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Az-fQOvm.css">
</head>
<body>