Skip to content

Conversation

steverydz
Copy link
Contributor

@steverydz steverydz commented Oct 22, 2025

Done

Fixes issue where banners are unable to be removed or changed

How to QA

Remove a banner image:

  • Go to https://snapcraft-io-5431.demos.haus/<SNAP_NAME>/listing
  • Remove the banner image and save the form
  • Check that it saves successfully
  • Reload the page
  • The banner should not be there

Upload a banner image when there isn't already one there:

  • Upload a banner image and save the form
  • Check that it saves successfully
  • Reload the page
  • The new banner should be there

Change an existing banner image:

  • Change an existing banner to a new image and save the form
  • Check that it saves successfully
  • Reload the page
  • The updated banner should be there

Testing

  • This PR has tests
  • No testing required (explain why): Existing tests

Issue / Card

Fixes https://warthogs.atlassian.net/browse/WD-30391
Fixes #5430

@Copilot Copilot AI review requested due to automatic review settings October 22, 2025 13:27
@webteam-app
Copy link

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug preventing users from changing or removing banner images in the publisher interface. The issue stemmed from conflicts in the changes.images array during form submission that caused a "modified during validation" error.

Key changes:

  • Filters out existing banner entries from changes.images when banner field is dirty to prevent override conflicts
  • Updates banner URL in changes.images when banner_urls field changes to ensure the new URL is properly persisted

// to the value of that field, otherwise the value doesn't
// change and therefore the banner doesn't change
if (changes.images && dirtyFields.banner_urls) {
const banner = changes.images.find((image) => image.type === "banner");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't you just remove the banner from changes.images in line 54? Or is it different case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bartaz Yeah, these are two different cases - banner and banner_urls are two different cases, which is confusing, but if banner changes that means the banner has been removed, and if banner_urls changes, that means one has been uploaded. I wasn't able to find a scenario where these fields would change at the same time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth adding this to (already useful) comments you added to the code. To clarify which one changes when.

Copy link
Member

@bartaz bartaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but maybe worth waiting for cache hotfix to land first before merging this, just to be sure.

@steverydz steverydz force-pushed the WD-30391-banner-upload-not-working branch from 30c3d61 to 491e9ba Compare October 22, 2025 15:05
@steverydz steverydz force-pushed the WD-30391-banner-upload-not-working branch from 491e9ba to cb6c309 Compare October 22, 2025 15:07
@steverydz steverydz merged commit 569734e into main Oct 22, 2025
13 checks passed
@steverydz steverydz deleted the WD-30391-banner-upload-not-working branch October 22, 2025 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error: "Cannot retrieve dimensions of banner, which was modified during validation"

3 participants