Skip to content

Commit

Permalink
fix: support callable cumulative configs
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Aug 15, 2024
1 parent bf3c091 commit 9f18380
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions vike-solid/renderer/getHeadSetting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ function getHeadSetting<T>(headSetting: HeadSetting, pageContext: PageContext &
}

// Set by +configName.js
const getCallable = (val: unknown) => (isCallable(val) ? val(pageContext) : val);
const val = pageContext.config[headSetting];
if (isCallable(val)) {
return val(pageContext) as any;
} else {
return val as any;
}
if (Array.isArray(val)) return val.map(getCallable) as any; // cumulative configs
return getCallable(val) as any;
}

0 comments on commit 9f18380

Please sign in to comment.