-
Notifications
You must be signed in to change notification settings - Fork 30
Explicitly set undefined column value to null #168
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
base: main
Are you sure you want to change the base?
Conversation
This won't work right - because we don't accept |
f947f40
to
1206f05
Compare
This got merged, so this works now 🕺🏽 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing so would keep the previously set value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That feels like we made a bad design decision there 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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