Skip to content

Commit

Permalink
Remove empty items from an array
Browse files Browse the repository at this point in the history
nhsuk-frontend doesn't neatly handle empty items in arrays. Until the frontend is patched, it's better to remove empty items before they get to the source component.
  • Loading branch information
fofr committed Nov 21, 2022
1 parent ede4dcd commit 828db4e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/decorate.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports.decorate = function (params, keyPath, componentName) {

if (params.items) {
params.idPrefix = params.id
params.items = params.items.map(item => {
params.items = params.items.filter(i => i).map(item => {
// Ignore dividers or empty items
if (item.divider || item === '') {
return item
Expand Down

0 comments on commit 828db4e

Please sign in to comment.