",
+ },
+ RPlatformIcon: true,
+ RTag: {
+ props: ["text"],
+ template: "{{ text }}",
+ },
+ RVirtualScroller: true,
+ },
+ },
+ });
+}
+
+describe("ScanPlatform", () => {
+ // Firmware already in the library is not a scan result: the header used to
+ // show the platform's total firmware count, so every re-scan looked like it
+ // had discovered firmware (issue #4049).
+ it("hides the firmware tag when the scan found no new firmware", () => {
+ const wrapper = mountPlatform({ new_firmware_count: 0 });
+
+ expect(wrapper.findAll(".r-tag")).toHaveLength(1);
+ });
+
+ it("shows the count of firmware discovered by this scan", () => {
+ const wrapper = mountPlatform({ new_firmware_count: 2 });
+
+ const tags = wrapper.findAll(".r-tag");
+ expect(tags).toHaveLength(2);
+ expect(tags[1].text()).toBe("2");
+ });
+
+ // The body only lists ROMs, so a firmware-only platform rendered an empty
+ // panel instead of the "no new roms" message.
+ it("reports no new roms even when firmware was found", () => {
+ const wrapper = mountPlatform({ new_firmware_count: 2 });
+
+ expect(wrapper.text()).toContain("scan.no-new-roms");
+ });
+});
diff --git a/frontend/src/v2/components/Scan/ScanPlatform.vue b/frontend/src/v2/components/Scan/ScanPlatform.vue
index d874ce1be..2a750721b 100644
--- a/frontend/src/v2/components/Scan/ScanPlatform.vue
+++ b/frontend/src/v2/components/Scan/ScanPlatform.vue
@@ -78,12 +78,12 @@ function getItemKey(item: unknown) {
-
+
{{ t("scan.no-new-roms") }}
{
scanningStore.setScanning(true);
// De-dupe by display_name so a re-scan of the same platform
@@ -66,7 +66,7 @@ export function installScanLifecycle() {
id,
fs_slug,
roms: [],
- firmware_count,
+ new_firmware_count,
is_identified,
});
@@ -132,7 +132,7 @@ export function installScanLifecycle() {
fs_slug: rom.platform_fs_slug,
is_identified: true,
roms: [],
- firmware_count: 0,
+ new_firmware_count: 0,
});
scannedPlatform = scanningStore.scanningPlatforms.at(0)!;
}
diff --git a/frontend/src/v2/views/Scan.vue b/frontend/src/v2/views/Scan.vue
index cda56f16d..0325ed27c 100644
--- a/frontend/src/v2/views/Scan.vue
+++ b/frontend/src/v2/views/Scan.vue
@@ -282,19 +282,18 @@ const effectiveMetadataSources = computed(() => {
return [...general, ...specific];
});
-// Auto-expand a platform's panel the moment it starts reporting roms
-// or firmware. We track by `id:hasContent` so the watch fires only on
-// the 0 → 1 transition, not per-ROM.
+// Auto-expand a platform's panel the moment it starts reporting roms. The
+// panel body only lists ROMs, so firmware alone leaves nothing to show. We
+// track by `id:hasRoms` so the watch fires only on the 0 → 1 transition,
+// not per-ROM.
const platformsWithRomsKey = computed(() =>
scanningPlatforms.value
- .map((p) => `${p.id}:${p.roms.length > 0 || p.firmware_count > 0 ? 1 : 0}`)
+ .map((p) => `${p.id}:${p.roms.length > 0 ? 1 : 0}`)
.join(","),
);
watch(platformsWithRomsKey, () => {
openPlatforms.value = new Set(
- scanningPlatforms.value
- .filter((p) => p.roms.length > 0 || p.firmware_count > 0)
- .map((p) => p.id),
+ scanningPlatforms.value.filter((p) => p.roms.length > 0).map((p) => p.id),
);
});
diff --git a/frontend/src/views/Scan.vue b/frontend/src/views/Scan.vue
index af1f7c655..5f9d25e75 100644
--- a/frontend/src/views/Scan.vue
+++ b/frontend/src/views/Scan.vue
@@ -87,18 +87,16 @@ watch(metadataOptions, (newOptions) => {
);
});
-// Track which platforms have ROMs/firmware without a deep watch on the entire array.
+// Track which platforms have ROMs without a deep watch on the entire array.
// The computed returns a stable string that only changes when a platform
-// transitions from 0→1+ ROMs/firmware (or back), so the watch fires O(n_platforms)
+// transitions from 0→1+ ROMs (or back), so the watch fires O(n_platforms)
// times rather than O(n_roms) times.
const platformsWithRomsKey = computed(() =>
- scanningPlatforms.value
- .map((p) => (p.roms.length > 0 || p.firmware_count > 0 ? 1 : 0))
- .join(""),
+ scanningPlatforms.value.map((p) => (p.roms.length > 0 ? 1 : 0)).join(""),
);
watch(platformsWithRomsKey, () => {
panels.value = scanningPlatforms.value
- .map((p, index) => (p.roms.length > 0 || p.firmware_count > 0 ? index : -1))
+ .map((p, index) => (p.roms.length > 0 ? index : -1))
.filter((index) => index !== -1);
});