fix: Allow changing audience type after creation of campaign
This commit is contained in:
@@ -220,7 +220,21 @@ export default function CampaignDetailsPage() {
|
|||||||
});
|
});
|
||||||
// Silent save - no toast notification
|
// Silent save - no toast notification
|
||||||
setHasChanges(false);
|
setHasChanges(false);
|
||||||
void mutate();
|
// Refetch and re-sync the edited campaign with fresh data
|
||||||
|
const updated = await mutate();
|
||||||
|
if (updated?.data) {
|
||||||
|
setEditedCampaign({
|
||||||
|
name: updated.data.name,
|
||||||
|
description: updated.data.description || '',
|
||||||
|
subject: updated.data.subject,
|
||||||
|
body: updated.data.body,
|
||||||
|
from: updated.data.from,
|
||||||
|
fromName: updated.data.fromName || '',
|
||||||
|
replyTo: updated.data.replyTo || '',
|
||||||
|
audienceType: updated.data.audienceType,
|
||||||
|
segmentId: updated.data.segmentId || undefined,
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error instanceof Error ? error.message : 'Failed to update campaign');
|
toast.error(error instanceof Error ? error.message : 'Failed to update campaign');
|
||||||
} finally {
|
} finally {
|
||||||
@@ -497,11 +511,6 @@ export default function CampaignDetailsPage() {
|
|||||||
title="Segment"
|
title="Segment"
|
||||||
description="Target a defined group of contacts"
|
description="Target a defined group of contacts"
|
||||||
/>
|
/>
|
||||||
<SelectItemWithDescription
|
|
||||||
value={CampaignAudienceType.FILTERED}
|
|
||||||
title="Filtered"
|
|
||||||
description="Use advanced filter conditions"
|
|
||||||
/>
|
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user