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 authored Jun 27, 2023
1 parent b10b90e commit 260411f
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

1 comment on commit 260411f

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 260411f.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5384328700
📝 Reported issues:

Please sign in to comment.