fix: Protect against redirecting back to the same doc

closes #975
This commit is contained in:
Tom Moor
2019-10-15 20:59:00 -07:00
parent b093acd94f
commit 97c8bfc27f

View File

@ -52,7 +52,11 @@ class Editor extends React.Component<Props> {
}
}
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');
}