Skip to content

Commit

Permalink
Fix possible NPE in RoleModel.groupByCategoryReaction (#3560)
Browse files Browse the repository at this point in the history
Co-authored-by: Greg Solomon <[email protected]>
  • Loading branch information
ghsolomon and Greg Solomon authored Jan 10, 2024
1 parent 0b16581 commit 503c0bd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions admin/tabs/general/roles/RoleModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,15 @@ export class RoleModel extends HoistModel {
}

private groupByCategoryReaction(): ReactionSpec<boolean> {
const {gridModel} = this;
return {
track: () => this.groupByCategory,
run: groupByCategory => {
const {gridModel} = this;
if (!gridModel) return;
gridModel.setGroupBy(groupByCategory ? 'category' : null);
gridModel.setColumnVisible('category', !groupByCategory);
gridModel.autosizeAsync();
},
fireImmediately: true
}
};
}

Expand Down Expand Up @@ -235,6 +235,7 @@ export class RoleModel extends HoistModel {
enableExport: true,
exportOptions: {filename: 'roles'},
filterModel: true,
groupBy: this.groupByCategory ? 'category' : null,
groupRowRenderer: ({value}) => (!value ? 'Uncategorized' : value),
headerMenuDisplay: 'hover',
onRowDoubleClicked: ({data: record}) =>
Expand Down Expand Up @@ -278,7 +279,7 @@ export class RoleModel extends HoistModel {
},
columns: [
{field: {name: 'name', type: 'string'}},
{field: {name: 'category', type: 'string'}},
{field: {name: 'category', type: 'string'}, hidden: this.groupByCategory},
{field: {name: 'lastUpdated', type: 'date'}, ...Col.dateTime, hidden: true},
{field: {name: 'lastUpdatedBy', type: 'string'}, hidden: true},
{field: {name: 'notes', type: 'string'}, filterable: false, flex: 1}
Expand Down

0 comments on commit 503c0bd

Please sign in to comment.