Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Press2 1679 bugfix regenerate version naming tab hover #467

Merged
3 changes: 2 additions & 1 deletion src/OnboardingSPA/components/TabPanelHover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
);
};

/* the default will be mouseover and will be click event if triggerEvent="click" is specifically passed */
const useEventTrigger = ( triggerEvent, handleEvent, tabName ) => {
const eventHandler = useCallback(
() => handleEvent( tabName ),
Expand All @@ -66,7 +67,7 @@
notActiveClass = 'is-not-active',
callback,
onSelect = noop,
triggerEvent = 'click',
triggerEvent,
} ) {
const instanceId = useInstanceId( TabPanelHover, 'tab-panel' );
const [ selected, setSelected ] = useState( null );
Expand All @@ -93,7 +94,7 @@
initialTabName || ( tabs.length > 0 ? tabs[ 0 ].name : null )
);
}
}, [ tabs ] );

Check warning on line 97 in src/OnboardingSPA/components/TabPanelHover/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'initialTabName' and 'selected'. Either include them or remove the dependency array. If 'setSelected' needs the current value of 'initialTabName', you can also switch to useReducer instead of useState and read 'initialTabName' in the reducer

return (
<div className={ className }>
Expand Down
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 @@ -82,7 +82,7 @@
return;
}

const { slug, color, isFavorite } = homepage || {};
const { slug, title, color, isFavorite } = homepage || {};
const response = await regenerateHomepage(
currentData.sitegen.siteDetails.prompt,
slug,
Expand All @@ -96,6 +96,14 @@
}

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 Expand Up @@ -215,7 +223,7 @@

useEffect( () => {
handleCustomize();
}, [] );

Check warning on line 226 in src/OnboardingSPA/steps/SiteGen/Editor/Header/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has a missing dependency: 'handleCustomize'. Either include it or remove the dependency array

useEffect( () => {
if ( currentData?.sitegen?.homepages?.active ) {
Expand All @@ -233,7 +241,7 @@
return () => {
setInteractionDisabled( false );
};
}, [ isSaving, isRegenerating ] );

Check warning on line 244 in src/OnboardingSPA/steps/SiteGen/Editor/Header/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has a missing dependency: 'setInteractionDisabled'. Either include it or remove the dependency array

return (
<>
Expand Down
Loading