Skip to content

Commit eea1e2d

Browse files
committed
Revert "Update CloudCode.react.js"
This reverts commit 44eea2a.
1 parent b85fe40 commit eea1e2d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/dashboard/Data/CloudCode/CloudCode.react.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import styles from 'dashboard/Data/CloudCode/CloudCode.scss';
1515
import Toolbar from 'components/Toolbar/Toolbar.react';
1616

1717
function getPath(params) {
18-
const last = params.location.pathname.split('cloud_code/')[1]
19-
return last;
18+
return params.splat;
2019
}
2120

2221
export default class CloudCode extends DashboardView {
@@ -32,12 +31,12 @@ export default class CloudCode extends DashboardView {
3231
}
3332

3433
componentWillMount() {
35-
this.fetchSource(this.context.currentApp, getPath(this.props));
34+
this.fetchSource(this.context.currentApp, getPath(this.props.params));
3635
}
3736

3837
componentWillReceiveProps(nextProps, nextContext) {
3938
if (this.context !== nextContext) {
40-
this.fetchSource(nextContext.currentApp, getPath(nextProps));
39+
this.fetchSource(nextContext.currentApp, getPath(nextProps.params));
4140
}
4241
}
4342

@@ -53,7 +52,7 @@ export default class CloudCode extends DashboardView {
5352

5453
if (!fileName || release.files[fileName] === undefined) {
5554
// Means we're still in /cloud_code/. Let's redirect to /cloud_code/main.js
56-
history.replace(this.context.generatePath(`cloud_code/${Object.keys(release.files)[0]}`))
55+
history.replace(this.context.generatePath('cloud_code/main.js'))
5756
} else {
5857
// Means we can load /cloud_code/<fileName>
5958
app.getSource(fileName).then(
@@ -67,7 +66,7 @@ export default class CloudCode extends DashboardView {
6766
}
6867

6968
renderSidebar() {
70-
let current = getPath(this.props) || '';
69+
let current = getPath(this.props.params) || '';
7170
let files = this.state.files;
7271
if (!files) {
7372
return null;
@@ -91,7 +90,7 @@ export default class CloudCode extends DashboardView {
9190
renderContent() {
9291
let toolbar = null;
9392
let content = null;
94-
let fileName = getPath(this.props);
93+
let fileName = getPath(this.props.params);
9594

9695
if (!this.state.files || Object.keys(this.state.files).length === 0) {
9796
content = (

0 commit comments

Comments
 (0)