Skip to content

Commit

Permalink
fix: various UI bugs (e.g. filter data browser, switch app, upload fi…
Browse files Browse the repository at this point in the history
…le) (#2010)
  • Loading branch information
visualfanatic committed Jan 23, 2022
1 parent 45c9b60 commit a508a58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/FileEditor/FileEditor.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default class FileEditor extends React.Component {
render() {
const file = this.props.value;
return (
<div ref={this.inputRef.current} style={{ minWidth: this.props.width, display: 'none' }} className={styles.editor}>
<div ref={this.inputRef} style={{ minWidth: this.props.width, display: 'none' }} className={styles.editor}>
<a className={styles.upload}>
<input ref={this.fileInputRef} id='fileInput' type='file' onChange={this.handleChange.bind(this)} />
<span>{file ? 'Replace file' : 'Upload file'}</span>
Expand Down
8 changes: 4 additions & 4 deletions src/dashboard/Data/Browser/Browser.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class Browser extends DashboardView {
}

componentWillReceiveProps(nextProps, nextContext) {
if (this.props.params.className !== nextProps.params.className) {
if (this.props.params.appId !== nextProps.params.appId || this.props.params.className !== nextProps.params.className || this.props.location.search !== nextProps.location.search) {
if (this.props.params.appId !== nextProps.params.appId || !this.props.params.className) {
this.setState({ counts: {} });
Parse.Object._clearAllState();
Expand All @@ -177,7 +177,7 @@ class Browser extends DashboardView {
.then(() => this.handleFetchedSchema());
}
if (!nextProps.params.className && nextProps.schema.data.get('classes')) {
this.redirectToFirstClass(nextProps.schema.data.get('classes'));
this.redirectToFirstClass(nextProps.schema.data.get('classes'), nextContext);
}
}

Expand Down Expand Up @@ -225,7 +225,7 @@ class Browser extends DashboardView {
return filters;
}

redirectToFirstClass(classList) {
redirectToFirstClass(classList, context) {
if (!classList.isEmpty()) {
let classes = Object.keys(classList.toObject());
classes.sort((a, b) => {
Expand All @@ -237,7 +237,7 @@ class Browser extends DashboardView {
}
return a.toUpperCase() < b.toUpperCase() ? -1 : 1;
});
history.replace(generatePath(this.context, 'browser/' + classes[0]));
history.replace(generatePath(context || this.context, 'browser/' + classes[0]));
}
}

Expand Down

0 comments on commit a508a58

Please sign in to comment.