From 8d81e9b01ca8458f9ff4c34b2ebae6ef6604da50 Mon Sep 17 00:00:00 2001 From: efuller Date: Wed, 26 Jun 2024 11:30:52 -0400 Subject: [PATCH] Rename resetMeta to resetTemplate --- hooks/useNewsletterMeta/index.ts | 4 ++-- plugins/newsletter-from-post/email-settings.tsx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hooks/useNewsletterMeta/index.ts b/hooks/useNewsletterMeta/index.ts index 8bc3e1a0..e714beee 100644 --- a/hooks/useNewsletterMeta/index.ts +++ b/hooks/useNewsletterMeta/index.ts @@ -30,7 +30,7 @@ function useNewsletterMeta() { nb_newsletter_sent_breaking_post_id: sentBreakingPostId = [], } = meta; - const resetMeta = useCallback(() => { + const resetTemplate = useCallback(() => { setMeta({ nb_breaking_template: 0, nb_breaking_content: '', @@ -54,7 +54,7 @@ function useNewsletterMeta() { content, sentBreakingPostId, }, - resetMeta, + resetTemplate, setMeta, }; } diff --git a/plugins/newsletter-from-post/email-settings.tsx b/plugins/newsletter-from-post/email-settings.tsx index 970a7f08..2a171f37 100644 --- a/plugins/newsletter-from-post/email-settings.tsx +++ b/plugins/newsletter-from-post/email-settings.tsx @@ -35,7 +35,7 @@ interface Window { function EmailSettings() { const [fetched, setFetched] = useState(false); const [invalidTemplate, setInvalidTemplate] = useState(false); - const { meta, resetMeta, setMeta } = useNewsletterMeta(); + const { meta, resetTemplate, setMeta } = useNewsletterMeta(); const { emailListOptions, selectedEmailList } = useEmailLists(); const manualSubject = meta.subject !== ''; const manualPreview = meta.preview !== ''; @@ -79,7 +79,7 @@ function EmailSettings() { const postIndex = blocks.findIndex((block) => block.name === 'wp-newsletter-builder/post'); if (postIndex === -1) { - resetMeta(); + resetTemplate(); setInvalidTemplate(true); return; } @@ -91,7 +91,7 @@ function EmailSettings() { setInvalidTemplate(false); setMeta({ nb_breaking_content: serialize(blocks) }); - }, [postId, resetMeta, setMeta]); + }, [postId, resetTemplate, setMeta]); const areRequiredFieldsSet = meta.type === '' || meta.template === ''