mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-04-12 15:40:30 +08:00
chore(blocks-antd): Add comments of possible undefined values.
This commit is contained in:
parent
b2abe1f1db
commit
b1d11b569d
@ -35,6 +35,7 @@ function getAllowedRegions({ allowedRegions, regions }) {
|
||||
|
||||
function getDefaultRegion({ allowedRegions, defaultRegion, uniqueValueOptions }) {
|
||||
if (!defaultRegion) {
|
||||
// if allowedRegions is an empty array, allowedRegions[0] would be undefined
|
||||
return getValueIndex(allowedRegions[0], uniqueValueOptions);
|
||||
}
|
||||
|
||||
@ -75,6 +76,7 @@ function AddOnSelect({
|
||||
onChange={(newVal) => {
|
||||
const input = value?.input;
|
||||
const region = uniqueValueOptions[newVal].value;
|
||||
// assumes that region is always defined and has a dial_code property
|
||||
const phone_number = `${region.dial_code}${input}`;
|
||||
|
||||
methods.setValue({
|
||||
@ -208,6 +210,7 @@ const PhoneNumberInput = ({
|
||||
}
|
||||
|
||||
const region = value.region;
|
||||
// assumes value.region is always defined and has a dial_code property
|
||||
const phone_number = `${region.dial_code}${input}`;
|
||||
|
||||
methods.setValue({
|
||||
|
Loading…
x
Reference in New Issue
Block a user