Skip to content

Commit

Permalink
Code optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
ljl committed Jun 12, 2023
1 parent 31fcca7 commit ace1f8a
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions client/app/components/Parameters.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export default class Parameters extends React.Component {
toCamelCase = str => {
if (isEmpty(str)) {
return "";

}
return str.replace(/\s+/g, "").toLowerCase();
};
Expand All @@ -63,9 +62,7 @@ export default class Parameters extends React.Component {
this.hideValues = Array.from(matches, match => match[1]);
}


componentDidUpdate(prevProps) {

componentDidUpdate = prevProps => {
const { parameters, disableUrlUpdate } = this.props;
const parametersChanged = prevProps.parameters !== parameters;
const disableUrlUpdateChanged = prevProps.disableUrlUpdate !== disableUrlUpdate;
Expand Down Expand Up @@ -171,9 +168,9 @@ export default class Parameters extends React.Component {
}

render() {
const { parameters } = this.state;
const { sortable, appendSortableToParent } = this.props;
const dirtyParamCount = size(filter(this.parameters, "hasPendingValue"));

const dirtyParamCount = size(filter(parameters, "hasPendingValue"));
return (
<SortableContainer
disabled={!sortable}
Expand All @@ -189,9 +186,7 @@ export default class Parameters extends React.Component {
className: "parameter-container",
onKeyDown: dirtyParamCount ? this.handleKeyDown : null,
}}>

{parameters && parameters.map((param, index) => (

<SortableElement key={param.name} index={index}>
<div
className="parameter-block"
Expand Down

0 comments on commit ace1f8a

Please sign in to comment.