Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip undefined attribute in Head #9856

Merged
merged 22 commits into from
Feb 3, 2020
Merged
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d2e2efb
Fix #8655, skip rendering meta tags with undefined props
lachlanjc Dec 28, 2019
69c19b7
Filter all tags, not just meta
lachlanjc Dec 28, 2019
7a35d88
Only render defined props
lachlanjc Dec 29, 2019
3756877
Merge branch 'canary' into fix-meta-undefined
lachlanjc Dec 29, 2019
c247ee6
Remove filtering of undefined strings
lachlanjc Dec 30, 2019
ef8c6b0
Merge branch 'canary' into fix-meta-undefined
Timer Dec 30, 2019
f317700
Merge branch 'canary' into fix-meta-undefined
ijjk Dec 31, 2019
dfa1a6a
Merge branch 'canary' into fix-meta-undefined
lachlanjc Jan 6, 2020
ec22d86
Replace Object.entries
lachlanjc Jan 6, 2020
08ab007
Remove filtering code
lachlanjc Jan 6, 2020
a77ffeb
Simplify code
lachlanjc Jan 7, 2020
58f1cb1
Merge branch 'canary' into fix-meta-undefined
lachlanjc Jan 7, 2020
f05c2b3
Merge branch 'canary' into fix-meta-undefined
lachlanjc Jan 14, 2020
8050b7c
Merge branch 'canary' into fix-meta-undefined
lachlanjc Jan 31, 2020
69aef18
Add test
lachlanjc Jan 31, 2020
9e4e016
Merge remote-tracking branch 'upstream/canary' into fix-meta-undefined
ijjk Feb 2, 2020
ddbd3c5
Add tests for undefined head prop value and tweak check
ijjk Feb 2, 2020
6cc1c9e
Merge remote-tracking branch 'upstream/canary' into fix-meta-undefined
ijjk Feb 2, 2020
6ed862d
Merge remote-tracking branch 'upstream/canary' into fix-meta-undefined
ijjk Feb 3, 2020
dff4aa5
Update to strip undefined prop values to match react
ijjk Feb 3, 2020
57b7408
Update head.js
Timer Feb 3, 2020
2af71a2
Merge branch 'canary' into fix-meta-undefined
Timer Feb 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/next/next-server/lib/head.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,11 @@ function reduceComponents(
.filter(unique())
.reverse()
.map((c: React.ReactElement<any>, i: number) => {
const key = c.key || i
return React.cloneElement(c, { key })
let props: { [key: string]: any } = { key: c.key || i }
Object.entries(c.props).forEach(([key, val]) => {
lachlanjc marked this conversation as resolved.
Show resolved Hide resolved
if (![val, typeof val].includes('undefined')) props[key] = val
lachlanjc marked this conversation as resolved.
Show resolved Hide resolved
})
return React.cloneElement(c, props)
})
}

Expand Down