Unverified Commit 80d574ec authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Do not mix `null` in `getCssLinks` return value (#8938)

parent 8391d48f
......@@ -146,26 +146,22 @@ export class Head extends Component<
getCssLinks() {
const { assetPrefix, files } = this.context._documentProps
if (!files || files.length === 0) {
return null
}
const cssFiles =
files && files.length ? files.filter(f => /\.css$/.test(f)) : []
return files.map((file: string) => {
// Only render .css files here
if (!/\.css$/.test(file)) {
return null
}
return (
<link
key={file}
nonce={this.props.nonce}
rel="stylesheet"
href={`${assetPrefix}/_next/${encodeURI(file)}`}
crossOrigin={this.props.crossOrigin || process.crossOrigin}
/>
)
})
return cssFiles.length === 0
? null
: cssFiles.map((file: string) => {
return (
<link
key={file}
nonce={this.props.nonce}
rel="stylesheet"
href={`${assetPrefix}/_next/${encodeURI(file)}`}
crossOrigin={this.props.crossOrigin || process.crossOrigin}
/>
)
})
}
getPreloadDynamicChunks() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment