-
Notifications
You must be signed in to change notification settings - Fork 116
fix: Fix not being able to change or remove banner #5431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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
whenbanner_urls
field changes to ensure the new URL is properly persisted
291475e
to
30c3d61
Compare
// 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"); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
30c3d61
to
491e9ba
Compare
491e9ba
to
cb6c309
Compare
Done
Fixes issue where banners are unable to be removed or changed
How to QA
Remove a banner image:
Upload a banner image when there isn't already one there:
Change an existing banner image:
Testing
Issue / Card
Fixes https://warthogs.atlassian.net/browse/WD-30391
Fixes #5430