- Notifications
You must be signed in to change notification settings - Fork8.4k
Closed as not planned
Description
Issue Description
- When editing an collection in Strapi 5's admin panel, the draft version's gallery can become contaminated with images from other entries in collection. The published version remains correct, but the draft version accumulates additional unwanted images.
- Steps to Reproduce
- Edit collection entry A's gallery in Strapi admin
- Navigate to collection entry A and edit its gallery
- Return to collection A and view its draft version
- Observe that collection A's draft version now contains images from collection entry B
Expected Behavior
- When editing a collection's gallery, only the images explicitly selected for that collection should be saved, with no cross-contamination between entries.
- Actual Behavior
- The draft version of a collection item accumulates images from other collection items. This creates a significant discrepancy between published and draft versions.
Technical Details
- When editing a gallery and switching between collection entries, Strapi 5 appears to maintain a state of previously selected media library items.
- The contamination is linked to browser session state, as different image sets appear depending on browsing history.
- The new Document System in Strapi 5 (which manages content variations like drafts and published states) is likely responsible, as this was introduced as a significant change from Strapi 4.
Verification
- We confirmed contamination by:
- Checking database records showing a significant discrepancy between published and draft versions (e.g., 15 images in published vs. 27 in draft).
- Identifying specific contaminating images that belong to other collection entries.
- Successfully cleaning contamination using direct database operations.
- Observing the pattern repeats when editing even after cleanup.
Impact
- This bug creates significant data integrity issues, as content editors may:
- Accidentally publish drafts with incorrect images from other collections
- Spend extra time manually identifying and removing contaminated images