Skip to content

Commit

Permalink
temp fix to display the renamed title in
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayadav09 committed Feb 15, 2024
1 parent a2b4924 commit cba2296
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/OnboardingSPA/steps/SiteGen/Editor/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down

0 comments on commit cba2296

Please sign in to comment.