fix(home): preview reflects what's on the frame, not what's queued
CI / test (push) Has been cancelled

Both the backend preview endpoint and the frontend cache-buster were
preferring lockedImage over currentImage. Locking is a queued override
that doesn't take effect until the device's next poll, so showing it on
Home before the device has actually pulled it lied about the frame's
state. Always use currentImage now.

Also: add a primary "+ Add Photo" button at the top of the Library page
so users can upload without bouncing back to Home; updates the empty-
state copy to point at the new button.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-06 19:15:14 -04:00
parent 328ad632d3
commit 2cd558bac3
17 changed files with 125 additions and 21 deletions
+9 -4
View File
@@ -176,9 +176,14 @@ class DeviceApiController extends AbstractController
}
/**
* Serve a PNG preview of the image currently shown on the frame, decoded
* from the device's rendered 4bpp Spectra-6 .bin so the colors match what
* the e-ink actually displays. The PNG is cached on disk next to the .bin.
* Serve a PNG preview of the image **currently shown on the frame**,
* decoded from the device's rendered 4bpp Spectra-6 .bin so the colors
* match what the e-ink actually displays.
*
* Always uses currentImage — the last image the device pulled — never
* lockedImage. A lock is a queued override that won't take effect until
* the device next polls; surfacing it on Home before the device has
* actually fetched it would lie about what's on the frame.
*/
#[Route('/{id}/preview', name: 'api_device_preview', methods: ['GET'])]
public function preview(int $id, EntityManagerInterface $em): Response
@@ -190,7 +195,7 @@ class DeviceApiController extends AbstractController
return $this->json(['error' => 'Device not found'], Response::HTTP_NOT_FOUND);
}
$image = $device->getLockedImage() ?? $device->getCurrentImage();
$image = $device->getCurrentImage();
if (!$image || $image->isDeleted()) {
return $this->json(['error' => 'No current image'], Response::HTTP_NOT_FOUND);
}