Explicitly set undefined column value to null#168
Conversation
|
This won't work right - because we don't accept |
f947f40 to
1206f05
Compare
This got merged, so this works now 🕺🏽 |
tom-james-watson
left a comment
There was a problem hiding this comment.
If you try and import this sheet, it will fail: https://docs.google.com/spreadsheets/d/1TcedbEOK3L9a4BCArLRkjHa5hgXtBZ93dzAL54eGApM/edit?gid=0#gid=0
| for (const headerRowName of uniqueHeaderRowNames) { | ||
| if (!(headerRowName in fieldData)) { | ||
| if (["string", "formattedText"].includes(fieldTypes[headerRowName])) { | ||
| fieldData[headerRowName] = "" | ||
| } else { | ||
| fieldData[headerRowName] = null | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Wait why are we not just omitting these values? It's not required that you pass values for all fields.
There was a problem hiding this comment.
Doing so would keep the previously set value
There was a problem hiding this comment.
That feels like we made a bad design decision there 🤔
There was a problem hiding this comment.
So yeah, this won't unset the value but just keep it as is
const managedCollection = await framer.getActiveManagedCollection()
await managedCollection.addItems([
{
id: "test",
slug: "test",
fieldData: {
"First Name": {
type: "string",
value: "John",
},
},
},
])
await managedCollection.addItems([{ id: "test", slug: "test", fieldData: {} }])709abde to
f303e8f
Compare
Description
This pull request ensures that when a field does not have a defined value it's set to null. Allowing to clear it.
Context
https://framer-team.slack.com/archives/C06L5H5ADK2/p1739362411251979
Testing