GRI-2174: playlist with a URL item cannot be saved a second time #306

Merged
vivy merged 2 commits from fix/GRI-2174-playlist-url-item-resave into dev 2026-11-17 13:59:37 +00:00
Member

Closes grimoire-of-digital-signage#302.

A URL (or page) playlist item read back from the server lost its kind/url/page. On the next save, replacePlaylistItems looked the item up in the library by media_id, found nothing for an empty id, and guessed kind: "image" with media_id: "" — which the server rejects with a UUID parse error.

Fix

  • itemFromWire now keeps kind, url and page on the PlaylistItem (frontend-web/src/api/types.ts).
  • replacePlaylistItems sends an item from its own kind/url/page when the library lookup by media_id has nothing (no media_id, or not found in the library). It never sends media_id: "" and never guesses 'image' — it throws if no kind is available at all (frontend-web/src/api/httpPlaylistsApi.ts).

Test plan

  • scripts/local-gates.sh --frontend-only passes (prettier, oxlint, tsc, vitest, build).
  • New test: load a playlist with a URL item + a document_page item, save unchanged → PUT body sends {kind:"url", url:...} with no media_id.
  • New test: add a URL item from the library, save, reload, change duration, save again → still a URL item.
Closes grimoire-of-digital-signage#302. A URL (or page) playlist item read back from the server lost its `kind`/`url`/`page`. On the next save, `replacePlaylistItems` looked the item up in the library by `media_id`, found nothing for an empty id, and guessed `kind: "image"` with `media_id: ""` — which the server rejects with a UUID parse error. ## Fix - `itemFromWire` now keeps `kind`, `url` and `page` on the `PlaylistItem` (`frontend-web/src/api/types.ts`). - `replacePlaylistItems` sends an item from its own `kind`/`url`/`page` when the library lookup by `media_id` has nothing (no `media_id`, or not found in the library). It never sends `media_id: ""` and never guesses `'image'` — it throws if no kind is available at all (`frontend-web/src/api/httpPlaylistsApi.ts`). ## Test plan - [x] `scripts/local-gates.sh --frontend-only` passes (prettier, oxlint, tsc, vitest, build). - [x] New test: load a playlist with a URL item + a document_page item, save unchanged → PUT body sends `{kind:"url", url:...}` with no `media_id`. - [x] New test: add a URL item from the library, save, reload, change duration, save again → still a URL item.
GRI-2174: keep kind/url/page on round-tripped playlist items
Some checks failed
CI / the pre-push hook (pull_request) Successful in 4s
CI / cargo fmt (pull_request) Successful in 4s
CI / install.sh client upgrade (pull_request) Successful in 13s
CI / cargo clippy (pull_request) Successful in 2m40s
CI / cargo deny advisories (pull_request) Failing after 1m45s
CI / cargo deny (pull_request) Successful in 1m52s
CI / repository boundary (pull_request) Successful in 16s
CI / frontend-web (pull_request) Successful in 2m7s
CI / cargo test (pull_request) Successful in 6m50s
CI / CI (pull_request) Failing after 1s
CI / Notify gate failed (pull_request) Successful in 1s
23ed9415e1
A URL or page item read back from the server carried no kind/url/page,
so replacePlaylistItems guessed kind 'image' and sent media_id: "" on
the next save. Carry kind/url/page through PlaylistItem and use them
when the library lookup by media_id has nothing; throw instead of
guessing a kind.
Merge branch 'dev' into fix/GRI-2174-playlist-url-item-resave
All checks were successful
CI / the pre-push hook (pull_request) Successful in 5s
CI / install.sh client upgrade (pull_request) Successful in 17s
CI / cargo fmt (pull_request) Successful in 6s
CI / cargo deny (pull_request) Successful in 35s
CI / cargo clippy (pull_request) Successful in 1m55s
CI / cargo deny advisories (pull_request) Successful in 36s
CI / repository boundary (pull_request) Successful in 4s
CI / frontend-web (pull_request) Successful in 1m15s
CI / cargo test (pull_request) Successful in 4m48s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 1s
78b0b7aaeb
vivy merged commit acdbda2c8d into dev 2026-11-17 13:59:37 +00:00
vivy deleted branch fix/GRI-2174-playlist-url-item-resave 2026-11-17 13:59:38 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage!306
No description provided.