Skip to content

Commit 1669673

Browse files
authored
make contactSearch and audioSettings optional in dialer page (#620)
* make contactSearch and audioSettings optional in dialer page * use ternary
1 parent 1335e97 commit 1669673

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/containers/DialerPage/index.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ function mapToProps(_, {
1515
locale,
1616
rateLimiter,
1717
webphone,
18-
audioSettings: {
19-
dialButtonVolume,
20-
dialButtonMuted,
21-
},
18+
audioSettings,
2219
}
2320
}) {
2421
const isWebphoneMode = (callingSettings.callingMode === callingModes.webphone);
@@ -36,7 +33,7 @@ function mapToProps(_, {
3633
),
3734
toNumber: dialerUI.toNumberField,
3835
recipient: dialerUI.recipient,
39-
searchContactList: contactSearch.sortedResult,
36+
searchContactList: contactSearch ? contactSearch.sortedResult : [],
4037
fromNumbers: callingSettings.fromNumbers,
4138
fromNumber: callingSettings.fromNumber,
4239
showSpinner: !(
@@ -46,8 +43,8 @@ function mapToProps(_, {
4643
connectivityMonitor.ready &&
4744
(!isWebphoneMode || !webphone || !waitingWebphoneConnected)
4845
),
49-
dialButtonVolume,
50-
dialButtonMuted,
46+
dialButtonVolume: audioSettings ? audioSettings.dialButtonVolume : 1,
47+
dialButtonMuted: audioSettings ? audioSettings.dialButtonMuted : 1,
5148
};
5249
}
5350

@@ -76,11 +73,13 @@ function mapToFunctions(_, {
7673
}),
7774
setRecipient: recipient => dialerUI.setRecipient(recipient),
7875
clearRecipient: () => dialerUI.clearRecipient(),
79-
searchContact: searchString => (
80-
contactSearch.debouncedSearch({ searchString })
81-
),
76+
searchContact: (searchString) => {
77+
if (!contactSearch) {
78+
return;
79+
}
80+
contactSearch.debouncedSearch({ searchString });
81+
},
8282
phoneTypeRenderer,
83-
8483
};
8584
}
8685

0 commit comments

Comments
 (0)