From 186f118dbb2834862285f76a9bc9505623481c53 Mon Sep 17 00:00:00 2001 From: Zak Burke Date: Thu, 1 Aug 2024 08:31:19 -0400 Subject: [PATCH] STRIPESFF-35 always permit navigation to /logout locations (#110) Always permit navigation to a `/logout` location, even if it would normally be prevented due to a dirty form. Refs STRIPESFF-35 --- CHANGELOG.md | 7 +++++++ lib/StripesFinalFormWrapper.js | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2ab8b9..8e68160 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## 8.1.0 IN PROGRESS +* Ignore the dirty-form prompt when navigating to a logout location. STRIPESFF-35. + +## [8.0.1](https://github.com/folio-org/stripes-final-form/tree/v8.0.1) (2024-03-13) +[Full Changelog](https://github.com/folio-org/stripes-final-form/compare/v8.0.0...v8.0.1) + +* Update translations + ## [8.0.0](https://github.com/folio-org/stripes-final-form/tree/v8.0.0) (2023-10-11) [Full Changelog](https://github.com/folio-org/stripes-final-form/compare/v7.0.0...v8.0.0) diff --git a/lib/StripesFinalFormWrapper.js b/lib/StripesFinalFormWrapper.js index ae8f3f3..2a5803b 100644 --- a/lib/StripesFinalFormWrapper.js +++ b/lib/StripesFinalFormWrapper.js @@ -31,6 +31,13 @@ class StripesFinalFormWrapper extends Component { if (navigationCheck) { this.unblock = history.block(nextLocation => { + // STRIPESFF-35 / STFORM-42 require the nav-prompt to be ignored + // on logout. consider calling a common function if this ever needs + // to be more elaborate; until then, admire this dead-simple impl. + if (nextLocation.pathname.startsWith('/logout')) { + return true; + } + const { dirty, submitSucceeded,