Skip to content

Commit

Permalink
Fix for React warnings for URL search parameters (mlflow#1446)
Browse files Browse the repository at this point in the history
  • Loading branch information
apurva-koti authored and smurching committed Jun 14, 2019
1 parent fec938b commit 9dadc33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
15 changes: 9 additions & 6 deletions mlflow/server/js/src/components/ExperimentPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class ExperimentPage extends Component {
this.state = {
...ExperimentPage.getDefaultUnpersistedState(),
persistedState: {
paramKeyFilterString: urlState.params,
metricKeyFilterString: urlState.metrics,
searchInput: urlState.search,
paramKeyFilterString: urlState.params === undefined ? "" : urlState.params,
metricKeyFilterString: urlState.metrics === undefined ? "" : urlState.metrics,
searchInput: urlState.search === undefined ? "" : urlState.search,
},
};
}
Expand All @@ -36,7 +36,6 @@ class ExperimentPage extends Component {
experimentId: PropTypes.number.isRequired,
dispatchSearchRuns: PropTypes.func.isRequired,
history: PropTypes.object.isRequired,
searchString: PropTypes.string.isRequired,
location: PropTypes.object,
};

Expand Down Expand Up @@ -108,8 +107,12 @@ class ExperimentPage extends Component {
}

updateUrlWithSearchFilter(state) {
this.props.history
.push(`/experiments/${this.props.experimentId}/s?${Utils.getSearchUrlFromState(state)}`);
const newUrl = `/experiments/${this.props.experimentId}` +
`/s?${Utils.getSearchUrlFromState(state)}`;
if (newUrl !== (this.props.history.location.pathname
+ this.props.history.location.search)) {
this.props.history.push(newUrl);
}
}

render() {
Expand Down
1 change: 0 additions & 1 deletion mlflow/server/js/src/utils/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ class Utils {

static getSearchParamsFromUrl(search) {
const params = qs.parse(search, {ignoreQueryPrefix: true});

const str = JSON.stringify(params,
function replaceUndefined(key, value) {
return (value === undefined) ? "" : value;
Expand Down

0 comments on commit 9dadc33

Please sign in to comment.