Skip to content

Commit

Permalink
Fix disappearing frontmatter entries (#2909)
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp authored May 6, 2024
1 parent 16d4c5f commit 8307d65
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion frontend/components/FrontmatterInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,20 @@ const clean_data = (obj) => {
? obj.map(clean_data).filter((x) => x != null)
: obj

return _.isEmpty(a) ? null : a
return !_.isNumber(a) && _.isEmpty(a) ? null : a
}

let test = clean_data({ a: 1, b: "", c: null, d: [], e: [1, "", null, 2], f: {}, g: [{}], h: [{ z: "asdf" }] })

console.assert(
_.isEqual(test, {
a: 1,
e: [1, 2],
h: [{ z: "asdf" }],
}),
test
)

const special_field_names = ["tags", "date", "license", "url", "color"]

const field_type = (name) => {
Expand Down

0 comments on commit 8307d65

Please sign in to comment.