From 19289855de6f04c31cf7c8769d80dabc74d6ead8 Mon Sep 17 00:00:00 2001 From: maziggy Date: Tue, 10 Feb 2026 12:31:14 +0100 Subject: [PATCH] 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 --- CHANGELOG.md | 1 + .../src/__tests__/pages/PrintersPage.test.tsx | 33 +++++++++++++++++++ frontend/src/pages/PrintersPage.tsx | 2 +- .../{index-DKpTCC1_.js => index-CbyBA630.js} | 2 +- static/index.html | 2 +- 5 files changed, 37 insertions(+), 3 deletions(-) rename static/assets/{index-DKpTCC1_.js => index-CbyBA630.js} (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8772c50f1..9c396e62f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/frontend/src/__tests__/pages/PrintersPage.test.tsx b/frontend/src/__tests__/pages/PrintersPage.test.tsx index 966ca9834..32020f280 100644 --- a/frontend/src/__tests__/pages/PrintersPage.test.tsx +++ b/frontend/src/__tests__/pages/PrintersPage.test.tsx @@ -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(); + + 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(); + }); }); }); diff --git a/frontend/src/pages/PrintersPage.tsx b/frontend/src/pages/PrintersPage.tsx index ebc5c603d..e39f48321 100644 --- a/frontend/src/pages/PrintersPage.tsx +++ b/frontend/src/pages/PrintersPage.tsx @@ -1992,7 +1992,7 @@ function PrinterCard({ )} {/* Firmware Version Badge */} - {firmwareInfo?.current_version && ( + {firmwareInfo?.current_version && firmwareInfo?.latest_version && (