-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing issue #237 #238
Fixing issue #237 #238
Conversation
src/lib/fragments/AgGrid.react.js
Outdated
@@ -413,6 +413,9 @@ export default class DashAgGrid extends Component { | |||
? this.suppressGetDetail(value.detailColName) | |||
: this.callbackGetDetail; | |||
} | |||
if ('detailGridOptions' in value) { | |||
value.detailGridOptions.components = this.state.components; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't be mutating value
(here or in the block above value.getDetailRowData = ...
, sorry I hadn't noticed this before) - so we should do something like:
let adjustedVal = value;
if ('suppressCallback' in value) {
adjustedVal = {
...adjustedval,
getDetailRowData: value.suppressCallback
? this.suppressGetDetail(value.detailColName)
: this.callbackGetDetail
};
}
if ('detailGridOptions' in value) {
adjustedVal = {
...adjustedVal,
detailGridOptions: {
...value.detailGridOptions,
components: this.state.components
}
};
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can also do this with https://ramdajs.com/docs/#assoc and assocPath
if you prefer, might be more compact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃
where grid components werent passed down to detail grids