Skip to content

Commit 8c8cc52

Browse files
author
Miriad
committed
Merge branch 'main' into dev
2 parents 1e06f04 + 7425042 commit 8c8cc52

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,12 @@ export async function getConfigValue<
9494
): Promise<ConfigTypeMap[T][K]> {
9595
try {
9696
const config = await getConfig(table);
97-
return config[key];
97+
const value = config[key];
98+
// Use fallback when field is undefined/null (not yet set in Sanity)
99+
if (value === undefined || value === null) {
100+
if (fallback !== undefined) return fallback;
101+
}
102+
return value;
98103
} catch {
99104
if (fallback !== undefined) return fallback;
100105
throw new Error(`Config value ${String(key)} not found in ${table}`);

0 commit comments

Comments
 (0)