replace current history entry on redirect to default branch instead of pushing a new history entry

This commit is contained in:
Eduard Heimbuch
2020-01-15 08:55:15 +01:00
parent bee0b68f37
commit 5c654b433b
2 changed files with 3 additions and 3 deletions

View File

@@ -34,7 +34,7 @@ class Sources extends React.Component<Props> {
fetchSources(repository, this.decodeRevision(revision), path);
if (branches?.length > 0 && !selectedBranch) {
const defaultBranch = branches?.filter(b => b.defaultBranch === true)[0];
this.props.history.push(`${baseUrl}/sources/${encodeURIComponent(defaultBranch.name)}/`);
this.props.history.replace(`${baseUrl}/sources/${encodeURIComponent(defaultBranch.name)}/`);
}
}
@@ -49,7 +49,7 @@ class Sources extends React.Component<Props> {
return revision ? decodeURIComponent(revision) : revision;
};
onSelectBranch = (branch?: Branch) => {
onSelectBranch = (branch?: Branch, replaceHistory?: boolean) => {
const { baseUrl, history, path } = this.props;
let url;
if (branch) {