Skip to content

Commit

Permalink
Revert "Update CloudCode.react.js"
Browse files Browse the repository at this point in the history
This reverts commit 44eea2a.
  • Loading branch information
dblythy committed Sep 4, 2021
1 parent b85fe40 commit eea1e2d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/dashboard/Data/CloudCode/CloudCode.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import styles from 'dashboard/Data/CloudCode/CloudCode.scss';
import Toolbar from 'components/Toolbar/Toolbar.react';

function getPath(params) {
const last = params.location.pathname.split('cloud_code/')[1]
return last;
return params.splat;
}

export default class CloudCode extends DashboardView {
Expand All @@ -32,12 +31,12 @@ export default class CloudCode extends DashboardView {
}

componentWillMount() {
this.fetchSource(this.context.currentApp, getPath(this.props));
this.fetchSource(this.context.currentApp, getPath(this.props.params));
}

componentWillReceiveProps(nextProps, nextContext) {
if (this.context !== nextContext) {
this.fetchSource(nextContext.currentApp, getPath(nextProps));
this.fetchSource(nextContext.currentApp, getPath(nextProps.params));
}
}

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

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

renderSidebar() {
let current = getPath(this.props) || '';
let current = getPath(this.props.params) || '';
let files = this.state.files;
if (!files) {
return null;
Expand All @@ -91,7 +90,7 @@ export default class CloudCode extends DashboardView {
renderContent() {
let toolbar = null;
let content = null;
let fileName = getPath(this.props);
let fileName = getPath(this.props.params);

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

0 comments on commit eea1e2d

Please sign in to comment.