Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
20 lines
824 B
Plaintext
20 lines
824 B
Plaintext
import { getDefaultValue } from '../../getDefaultValue.js';
|
|
import { cloneDataFromOriginalDoc } from '../beforeChange/cloneDataFromOriginalDoc.js';
|
|
export async function getFallbackValue({ field, req, siblingDoc }) {
|
|
let fallbackValue = undefined;
|
|
if ('name' in field && field.name) {
|
|
if (typeof siblingDoc[field.name] !== 'undefined') {
|
|
fallbackValue = cloneDataFromOriginalDoc(siblingDoc[field.name]);
|
|
} else if ('defaultValue' in field && typeof field.defaultValue !== 'undefined') {
|
|
fallbackValue = await getDefaultValue({
|
|
defaultValue: field.defaultValue,
|
|
locale: req.locale || '',
|
|
req,
|
|
user: req.user
|
|
});
|
|
}
|
|
}
|
|
return fallbackValue;
|
|
}
|
|
|
|
//# sourceMappingURL=getFallbackValue.js.map |