Use default value for undefined meta values
This commit is contained in:
@@ -35,7 +35,11 @@ export const getMetadataValueFrom = <Key extends AppMetadataKeys, Value extends
|
|||||||
): Value | undefined => {
|
): Value | undefined => {
|
||||||
const metadata = applyMigrations ? applyMetadataMigrations(meta) : meta;
|
const metadata = applyMigrations ? applyMetadataMigrations(meta) : meta;
|
||||||
|
|
||||||
if (metadata === undefined || !doesMetadataKeyExistIn(metadata, key)) {
|
if (
|
||||||
|
metadata === undefined ||
|
||||||
|
!doesMetadataKeyExistIn(metadata, key) ||
|
||||||
|
metadata[getMetadataKey(key)] === undefined
|
||||||
|
) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user