Skip to content

Commit

Permalink
Fix content profile closing after canceling a groups' creation
Browse files Browse the repository at this point in the history
  • Loading branch information
thecalcc committed Apr 16, 2024
1 parent 938f153 commit 63bf22e
Show file tree
Hide file tree
Showing 2 changed files with 1,842 additions and 4,160 deletions.
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
Loading

0 comments on commit 63bf22e

Please sign in to comment.