From 97c8bfc27f82817efbb68ae72cd78f96ede6b684 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 15 Oct 2019 20:59:00 -0700 Subject: [PATCH] fix: Protect against redirecting back to the same doc closes #975 --- app/components/Editor/Editor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/components/Editor/Editor.js b/app/components/Editor/Editor.js index 4fa087693..139bcbe7d 100644 --- a/app/components/Editor/Editor.js +++ b/app/components/Editor/Editor.js @@ -52,7 +52,11 @@ class Editor extends React.Component { } } - this.redirectTo = navigateTo; + // protect against redirecting back to the same place + const currentLocation = window.location.pathname + window.location.hash; + if (currentLocation !== navigateTo) { + this.redirectTo = navigateTo; + } } else { window.open(href, '_blank'); }