fix: react-doctor rerender-state-only-in-handlers 46→~30 (lastFetchedBrandId/bodyHtml/rawHeaders/rawRows/useBucket/pendingImageUrl/prevSyncKey to useRef)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import type { Campaign, CampaignType, CampaignStatus, AudienceRules } from "@/actions/communications/campaigns";
|
||||
import { formatDate } from "@/lib/format-date";
|
||||
@@ -338,7 +338,8 @@ export function CampaignEditPanel({
|
||||
const [name, setName] = useState<string>(() => campaign?.name ?? "");
|
||||
const [subject, setSubject] = useState<string>(() => campaign?.subject ?? "");
|
||||
const [bodyText, setBodyText] = useState<string>(() => campaign?.body_text ?? "");
|
||||
const [bodyHtml, setBodyHtml] = useState<string>(() => campaign?.body_html ?? "");
|
||||
const bodyHtmlRef = useRef<string>(campaign?.body_html ?? "");
|
||||
const setBodyHtml = (v: string) => { bodyHtmlRef.current = v; };
|
||||
const [templateId, setTemplateId] = useState<string>(() => campaign?.template_id ?? "");
|
||||
const [campaignType, setCampaignType] = useState<CampaignType>(
|
||||
() => campaign?.campaign_type ?? "operational"
|
||||
@@ -440,7 +441,7 @@ export function CampaignEditPanel({
|
||||
name,
|
||||
subject,
|
||||
body_text: bodyText,
|
||||
body_html: bodyHtml || undefined,
|
||||
body_html: bodyHtmlRef.current || undefined,
|
||||
template_id: templateId || undefined,
|
||||
campaign_type: campaignType,
|
||||
status: scheduleMode === "later" ? "scheduled" : (campaign?.status ?? "draft"),
|
||||
|
||||
Reference in New Issue
Block a user