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 653b808 commit a53b7c1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/vike-react/src/renderer/getHeadSetting.tsx
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 a53b7c1

Please sign in to comment.