Use default value for undefined meta values

This commit is contained in:
schroda
2024-10-14 03:12:51 +02:00
parent c477911e25
commit 387adb78ca

View File

@@ -35,7 +35,11 @@ export const getMetadataValueFrom = <Key extends AppMetadataKeys, Value extends
): Value | undefined => {
const metadata = applyMigrations ? applyMetadataMigrations(meta) : meta;
if (metadata === undefined || !doesMetadataKeyExistIn(metadata, key)) {
if (
metadata === undefined ||
!doesMetadataKeyExistIn(metadata, key) ||
metadata[getMetadataKey(key)] === undefined
) {
return defaultValue;
}