Skip to content

Commit

Permalink
fix empty slug breaking url (#8974)
Browse files Browse the repository at this point in the history
  • Loading branch information
suddjian authored and mistercrunch committed Jan 16, 2020
1 parent ff9bc74 commit 7e67190
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
12 changes: 7 additions & 5 deletions superset/assets/src/dashboard/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,13 @@ class Header extends React.PureComponent {
metadata: JSON.parse(updates.jsonMetadata),
});
this.props.dashboardTitleChanged(updates.title);
history.pushState(
{ event: 'dashboard_properties_changed' },
'',
`/superset/dashboard/${updates.slug}/`,
);
if (updates.slug) {
history.pushState(
{ event: 'dashboard_properties_changed' },
'',
`/superset/dashboard/${updates.slug}/`,
);
}
}}
/>
)}
Expand Down
10 changes: 5 additions & 5 deletions superset/assets/src/dashboard/components/PropertiesModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ class PropertiesModal extends React.PureComponent {
this.state = {
errors: [],
values: {
dashboard_title: this.props.dashboardTitle,
slug: this.props.dashboardInfo.slug,
owners: this.props.owners || [],
json_metadata: JSON.stringify(this.props.dashboardInfo.metadata),
dashboard_title: props.dashboardTitle,
slug: props.dashboardInfo.slug,
owners: props.owners || [],
json_metadata: JSON.stringify(props.dashboardInfo.metadata),
},
isOwnersLoaded: false,
userOptions: null,
Expand Down Expand Up @@ -189,7 +189,7 @@ class PropertiesModal extends React.PureComponent {
name="slug"
type="text"
bsSize="sm"
value={values.slug}
value={values.slug || ''}
onChange={this.onChange}
/>
<p className="help-block">
Expand Down

0 comments on commit 7e67190

Please sign in to comment.