Skip to content

Commit

Permalink
Adjustment to use assocPath and not mutate value in the process
Browse files Browse the repository at this point in the history
  • Loading branch information
BSd3v committed Aug 31, 2023
1 parent 3c54c0c commit e890b8d
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/lib/fragments/AgGrid.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
omit,
includes,
assoc,
assocPath,
} from 'ramda';
import {
propTypes as _propTypes,
Expand Down Expand Up @@ -408,15 +409,23 @@ export default class DashAgGrid extends Component {
return this.convertCol(value);
}
if (GRID_NESTED_FUNCTIONS[target]) {
let adjustedVal = value;
if ('suppressCallback' in value) {
value.getDetailRowData = value.suppressCallback
? this.suppressGetDetail(value.detailColName)
: this.callbackGetDetail;
adjustedVal = {
...adjustedVal,
getDetailRowData: value.suppressCallback
? this.suppressGetDetail(value.detailColName)
: this.callbackGetDetail,
};
}
if ('detailGridOptions' in value) {
value.detailGridOptions.components = this.state.components;
adjustedVal = assocPath(
['detailGridOptions', 'components'],
this.state.components,
adjustedVal
);
}
return this.convertAllProps(value);
return this.convertAllProps(adjustedVal);
}
if (GRID_DANGEROUS_FUNCTIONS[target]) {
return this.convertMaybeFunctionNoParams(value, {prop: target});
Expand Down

0 comments on commit e890b8d

Please sign in to comment.