Skip to content

6592: Fix slide media array not syncing with content on media removal#295

Merged
tuj merged 14 commits intodevelopfrom
hotfix/2.6.1
Mar 2, 2026
Merged

6592: Fix slide media array not syncing with content on media removal#295
tuj merged 14 commits intodevelopfrom
hotfix/2.6.1

Conversation

@turegjorup
Copy link
Contributor

Summary

  • Fix handleMedia() in slide-manager which was append-only — removing or replacing media in a content field left stale IRIs in the media array sent to the API
  • Fix clearing one media field wiping all media associations including those from other fields
  • Extract rebuildMediaFromContent() utility that derives the media array from content fields on every change
  • Add 7 Playwright tests verifying the media sync logic

Related

Cross-reference: os2display/display-api-service#347

Test plan

  • Verify existing Playwright tests pass: docker compose run --rm playwright npx playwright test
  • Verify new media sync tests pass: docker compose run --rm playwright npx playwright test e2e/slide-media-sync.spec.js
  • Manual test: edit a slide, add media, remove it, save — verify the media array in the PUT request no longer contains the removed media
  • Manual test: edit a slide with multiple media fields, clear one field — verify media from other fields are preserved

🤖 Generated with Claude Code

The media array sent to the API was append-only — removing or replacing
media in a content field left stale IRIs in the media array. Additionally,
clearing one media field would wipe all media associations including those
from other fields. Extract rebuildMediaFromContent utility that derives
the media array from content fields on every change, and add tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@turegjorup turegjorup marked this pull request as draft February 27, 2026 09:40
@turegjorup turegjorup requested a review from tuj February 27, 2026 09:40
turegjorup and others added 2 commits February 27, 2026 10:40
rebuildMediaFromContent only scanned explicitly tracked mediaFields,
which start empty and only get populated when handleMedia is called.
This meant the first media change on a slide with multiple media fields
would drop media from untouched fields. Now also scans all top-level
content keys to catch untracked media arrays.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tuj tuj marked this pull request as ready for review March 2, 2026 09:31
@tuj tuj merged commit f1233e0 into develop Mar 2, 2026
4 checks passed
@tuj tuj deleted the hotfix/2.6.1 branch March 2, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants