Skip to content

fix(frontend): Display Format selector never shows on device page - #36

Open
docloulou wants to merge 1 commit into
usetrmnl:mainfrom
docloulou:fix/display-format-models
Open

docloulou wants to merge 1 commit into
usetrmnl:mainfrom
docloulou:fix/display-format-models

Conversation

@docloulou

Copy link
Copy Markdown

On 0.6.0 the Display Format selector on the device detail page is never rendered, so it's impossible to switch a device to the BMP or TRMNL X models from the UI.

GET /api/models returns the backend list shape { data: { items: [...] } } (wrapListResponse in ModelsService.findAll), but modelService.getAll() only handled a raw array or { data: [...] }, so it returned the { items } object. models.length was then undefined, so the {models && models.length > 0 && …} block in DeviceDetail.tsx was skipped.

Fix: also unwrap data.items. A regression test fails before and passes after. bun run test gives 21 passed and bun run build is OK.

GET /api/models returns the backend list shape { data: { items } }
(wrapListResponse), but modelService.getAll() only handled a raw array or
{ data: [] } and returned the { items } object. models.length was then
undefined, so DeviceDetail never rendered the Display Format <select>.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant