From cba2296c865e9e5876391d93492c203e80c653ac Mon Sep 17 00:00:00 2001 From: ajayadav09 Date: Fri, 16 Feb 2024 02:58:11 +0530 Subject: [PATCH] temp fix to display the renamed title in --- src/OnboardingSPA/steps/SiteGen/Editor/Header/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/OnboardingSPA/steps/SiteGen/Editor/Header/index.js b/src/OnboardingSPA/steps/SiteGen/Editor/Header/index.js index 39e164a38..246bd0abc 100644 --- a/src/OnboardingSPA/steps/SiteGen/Editor/Header/index.js +++ b/src/OnboardingSPA/steps/SiteGen/Editor/Header/index.js @@ -81,7 +81,7 @@ const StepSiteGenEditorHeader = () => { return; } - const { slug, color, isFavorite } = homepage || {}; + const { slug, title, color, isFavorite } = homepage || {}; const response = await regenerateHomepage( currentData.sitegen.siteDetails.prompt, slug, @@ -95,6 +95,14 @@ const StepSiteGenEditorHeader = () => { } const regeneratedHomepage = response.body; + /* The below condition is a temp work-around as during the rename the homepage title is not saved the options table directly, + but is update in the local state only, so to display the Title of the newly regeneated page we assign the newly renamed title */ + if ( isFavorite ) { + const renamedTitleWithSuffix = `${ title } (Copy)`; + if ( renamedTitleWithSuffix !== regeneratedHomepage?.title ) { + regeneratedHomepage.title = renamedTitleWithSuffix; + } + } homepages[ regeneratedHomepage.slug ] = regeneratedHomepage; currentData.sitegen.homepages.data = homepages; currentData.sitegen.homepages.active = regeneratedHomepage;