We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1e06f04 + 7425042 commit 8c8cc52Copy full SHA for 8c8cc52
lib/config.ts
@@ -94,7 +94,12 @@ export async function getConfigValue<
94
): Promise<ConfigTypeMap[T][K]> {
95
try {
96
const config = await getConfig(table);
97
- return config[key];
+ 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;
103
} catch {
104
if (fallback !== undefined) return fallback;
105
throw new Error(`Config value ${String(key)} not found in ${table}`);
0 commit comments