Skip to content

Commit

Permalink
add no existent props handler
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinBeczak committed Oct 30, 2023
1 parent 05a028d commit a94767b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class TaskCompletionStep1 extends Component {

completeTask = (shortcut) => {
// Ignore if shortcut group is not active
if (_isEmpty(this.props.activeKeyboardShortcuts[hiddenShortcutGroup])) {
if (_isEmpty(this.props.activeKeyboardShortcuts?.[hiddenShortcutGroup])) {
return;
}

Expand All @@ -60,7 +60,7 @@ export default class TaskCompletionStep1 extends Component {

componentDidUpdate() {
if (
!_isEmpty(this.props.activeKeyboardShortcuts[hiddenShortcutGroup]) &&
!_isEmpty(this.props.activeKeyboardShortcuts?.[hiddenShortcutGroup]) &&
this.props.editMode
) {
hiddenShortcuts.forEach((shortcut) => {
Expand All @@ -71,7 +71,7 @@ export default class TaskCompletionStep1 extends Component {
);
});
} else if (
_isEmpty(this.props.activeKeyboardShortcuts[hiddenShortcutGroup]) &&
_isEmpty(this.props.activeKeyboardShortcuts?.[hiddenShortcutGroup]) &&
this.props.keyboardShortcutGroups &&
this.props.activateKeyboardShortcut &&
!this.props.editMode
Expand All @@ -87,7 +87,7 @@ export default class TaskCompletionStep1 extends Component {
}

componentWillUnmount() {
if (!_isEmpty(this.props.activeKeyboardShortcuts[hiddenShortcutGroup])) {
if (!_isEmpty(this.props.activeKeyboardShortcuts?.[hiddenShortcutGroup])) {
hiddenShortcuts.forEach((shortcut) => {
this.props.deactivateKeyboardShortcut(
hiddenShortcutGroup,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class TaskCompletionStep2 extends Component {

completeTask = (shortcut) => {
// Ignore if shortcut group is not active
if (_isEmpty(this.props.activeKeyboardShortcuts[hiddenShortcutGroup])) {
if (_isEmpty(this.props.activeKeyboardShortcuts?.[hiddenShortcutGroup])) {
return;
}

Expand All @@ -55,7 +55,7 @@ export default class TaskCompletionStep2 extends Component {

componentDidUpdate() {
if (
!_isEmpty(this.props.activeKeyboardShortcuts[hiddenShortcutGroup]) &&
!_isEmpty(this.props.activeKeyboardShortcuts?.[hiddenShortcutGroup]) &&
this.props.editMode
) {
hiddenShortcuts.forEach((shortcut) => {
Expand All @@ -66,7 +66,7 @@ export default class TaskCompletionStep2 extends Component {
);
});
} else if (
_isEmpty(this.props.activeKeyboardShortcuts[hiddenShortcutGroup]) &&
_isEmpty(this.props.activeKeyboardShortcuts?.[hiddenShortcutGroup]) &&
this.props.keyboardShortcutGroups &&
this.props.activateKeyboardShortcut &&
!this.props.editMode
Expand All @@ -82,7 +82,7 @@ export default class TaskCompletionStep2 extends Component {
}

componentWillUnmount() {
if (!_isEmpty(this.props.activeKeyboardShortcuts[hiddenShortcutGroup])) {
if (!_isEmpty(this.props.activeKeyboardShortcuts?.[hiddenShortcutGroup])) {
hiddenShortcuts.forEach((shortcut) => {
this.props.deactivateKeyboardShortcut(
hiddenShortcutGroup,
Expand Down

0 comments on commit a94767b

Please sign in to comment.