From 60319f4866f2c1bde98f7dabca55adb14dd0f5f0 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Wed, 17 Apr 2024 13:24:09 +0300 Subject: [PATCH] Fix content profile closing after canceling a groups' creation (#1964) --- client/components/ContentProfiles/GroupTab/index.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/client/components/ContentProfiles/GroupTab/index.tsx b/client/components/ContentProfiles/GroupTab/index.tsx index 67532d40b..2e4cbc87b 100644 --- a/client/components/ContentProfiles/GroupTab/index.tsx +++ b/client/components/ContentProfiles/GroupTab/index.tsx @@ -103,13 +103,22 @@ export class GroupTabComponent extends React.Component { 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 );