Skip to content

Commit

Permalink
Fix content profile closing after canceling a groups' creation (#1964)
Browse files Browse the repository at this point in the history
  • Loading branch information
thecalcc authored and petrjasek committed Apr 24, 2024
1 parent 5a52084 commit 60319f4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion client/components/ContentProfiles/GroupTab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,22 @@ export class GroupTabComponent extends React.Component<IProps, IState> {

isEditorDirty() {
if (this.state.selectedGroup != null) {
/**
* If a new group is being created, its not in this.props.profile.groups,
* making the next checks unnecessary. Regardless of that, if this is the case,
* there's no need to check further.
*/
if (this.state.creatingNewGroup) {
return true;
}

const originalGroup = this.props.profile.groups[this.state.selectedGroup._id];
const updatedGroup = {
...this.state.selectedGroup,
index: originalGroup.index,
};

return this.state.creatingNewGroup || !isEqual(
return !isEqual(
originalGroup,
updatedGroup
);
Expand Down

0 comments on commit 60319f4

Please sign in to comment.