diff --git a/frontend/src/component/common/util.js b/frontend/src/component/common/util.js
index 8d6eb63959..0836d9c2f5 100644
--- a/frontend/src/component/common/util.js
+++ b/frontend/src/component/common/util.js
@@ -85,14 +85,9 @@ export function updateWeight(variants, totalWeight) {
});
}
-export function loadNameFromHash() {
- let field = '';
- try {
- [, field] = document.location.hash.match(/name=([a-z0-9-_.]+)/i);
- } catch (e) {
- // nothing
- }
- return field;
+export function loadNameFromUrl() {
+ const params = new URLSearchParams(document.location.search);
+ return params.get('name') || '';
}
export const modalStyles = {
diff --git a/frontend/src/component/feature/FeatureToggleList/__tests__/__snapshots__/feature-list-item-component-test.jsx.snap b/frontend/src/component/feature/FeatureToggleList/__tests__/__snapshots__/feature-list-item-component-test.jsx.snap
index 519e35cdf4..51202aee47 100644
--- a/frontend/src/component/feature/FeatureToggleList/__tests__/__snapshots__/feature-list-item-component-test.jsx.snap
+++ b/frontend/src/component/feature/FeatureToggleList/__tests__/__snapshots__/feature-list-item-component-test.jsx.snap
@@ -77,7 +77,7 @@ exports[`renders correctly with one feature 1`] = `
dateTime="2018-02-04T20:27:52.127Z"
title="2018-02-04T20:27:52.127Z"
>
- 3 years ago
+ 4 years ago
@@ -178,7 +178,7 @@ exports[`renders correctly with one feature without permission 1`] = `
dateTime="2018-02-04T20:27:52.127Z"
title="2018-02-04T20:27:52.127Z"
>
- 3 years ago
+ 4 years ago
diff --git a/frontend/src/component/feature/create/CreateFeature/index.jsx b/frontend/src/component/feature/create/CreateFeature/index.jsx
index 02f5e4b1b0..f7c7b97bcc 100644
--- a/frontend/src/component/feature/create/CreateFeature/index.jsx
+++ b/frontend/src/component/feature/create/CreateFeature/index.jsx
@@ -6,7 +6,7 @@ import {
validateName,
} from '../../../../store/feature-toggle/actions';
import CreateFeature from './CreateFeature';
-import { loadNameFromHash, showPnpsFeedback } from '../../../common/util';
+import { loadNameFromUrl, showPnpsFeedback } from '../../../common/util';
import { showFeedback } from '../../../../store/feedback/actions';
const defaultStrategy = {
@@ -27,7 +27,7 @@ function resolveCurrentProjectId(settings) {
class WrapperComponent extends Component {
constructor(props) {
super();
- const name = loadNameFromHash();
+ const name = loadNameFromUrl();
this.state = {
featureToggle: {
name,
diff --git a/frontend/src/component/strategies/CreateStrategy/index.js b/frontend/src/component/strategies/CreateStrategy/index.js
index ff80cc6477..ae7747e27f 100644
--- a/frontend/src/component/strategies/CreateStrategy/index.js
+++ b/frontend/src/component/strategies/CreateStrategy/index.js
@@ -9,7 +9,7 @@ import {
} from '../../../store/strategy/actions';
import CreateStrategy from './CreateStrategy';
-import { loadNameFromHash } from '../../common/util';
+import { loadNameFromUrl } from '../../common/util';
const STRATEGY_EXIST_ERROR = 'Error: Strategy with name';
@@ -141,7 +141,7 @@ const mapStateToProps = (state, props) => {
return {
strategy: strategy
? strategy
- : { name: loadNameFromHash(), description: '', parameters: [] },
+ : { name: loadNameFromUrl(), description: '', parameters: [] },
editMode,
};
};