Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ export default function BackToPageNotification() {
* switches from focusing on editing page content to editing a template.
*/
export function useBackToPageNotification() {
const hasPageContentFocus = useSelect(
( select ) => select( editSiteStore ).hasPageContentFocus(),
const { isPage, hasPageContentFocus } = useSelect(
( select ) => ( {
isPage: select( editSiteStore ).isPage(),
hasPageContentFocus: select( editSiteStore ).hasPageContentFocus(),
} ),
[]
);

Expand All @@ -39,6 +42,7 @@ export function useBackToPageNotification() {
useEffect( () => {
if (
! alreadySeen.current &&
isPage &&
prevHasPageContentFocus.current &&
! hasPageContentFocus
) {
Expand All @@ -57,6 +61,7 @@ export function useBackToPageNotification() {
prevHasPageContentFocus.current = hasPageContentFocus;
}, [
alreadySeen,
isPage,
prevHasPageContentFocus,
hasPageContentFocus,
createInfoNotice,
Expand Down