Skip to content

fix(ui): clear accepted leave navigation targets#17398

Draft
rasitakyol wants to merge 1 commit into
payloadcms:mainfrom
rasitakyol:agent/fix-leave-without-saving-navigation
Draft

fix(ui): clear accepted leave navigation targets#17398
rasitakyol wants to merge 1 commit into
payloadcms:mainfrom
rasitakyol:agent/fix-leave-without-saving-navigation

Conversation

@rasitakyol

Copy link
Copy Markdown
Contributor

What?

  • Consume a cancelled navigation target before starting the accepted route transition.
  • Extend the admin E2E regression through a subsequent Create New navigation.

Why?

The accepted URL remained in a ref after the first transition. If the effect ran again, it could push the stale list URL and immediately undo the user's next navigation.

How?

  • Snapshot and clear the ref before invoking onAccept and router.push.
  • Verify the full dirty form, Leave anyway, list, and Create New flow in Chromium.
  • Validated with Node 24.15.0 and pnpm 11.9.0: the focused E2E passed 1/1, pnpm build:ui --force passed, and Prettier, source ESLint, and git diff --check passed.

Fixes #17233

@rasitakyol

Copy link
Copy Markdown
Contributor Author

CI note: the current failing job is E2E - lexical__collections__LexicalHeadingFeature [next]. It times out waiting for [data-lexical-editor="true"] in test/lexical/collections/LexicalHeadingFeature/e2e.spec.ts, before the navigation flow changed by this PR runs.

This PR only changes usePreventLeave.tsx and the general admin E2E regression. The focused Chromium regression passes locally (1/1), and pnpm build:ui --force passes. All Green is failing only as the aggregate of that Lexical job.

Could a maintainer rerun the failed Actions job? I do not have permission to rerun workflows in the upstream repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v3] "Create New" form immediately closes/redirects after leaving a dirty form via "Leave anyway"

1 participant