Skip to content

Commit

Permalink
Fix: Force campaign save on initial publish (#7715)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjohnson authored Feb 17, 2025
1 parent f9244ae commit a9132d2
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ export default function CampaignsDetailsPage({campaignId}) {
}, [campaign?.status]);

const onSubmit: SubmitHandler<Campaign> = async (data) => {
if (formState.isDirty) {

const shouldSave = formState.isDirty
// Force save if first publish to account for a race condition.
|| (campaign.status === 'draft' && data.status === 'active');

if (shouldSave) {
setIsSaving(data.status);

edit(data);
Expand Down

0 comments on commit a9132d2

Please sign in to comment.