Skip to content

Commit

Permalink
Don't show 'Back to page' notification when navigating away from page
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks committed Jun 26, 2023
1 parent bbd2abb commit e4093ba
Showing 1 changed file with 7 additions and 2 deletions.
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

0 comments on commit e4093ba

Please sign in to comment.