Feat: Better default value handling just like Notion #20604
git-init-priyanshu
started this conversation in
Ideas
Replies: 1 comment 2 replies
|
I would like to work on this feature if that is ok. Thanks. |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Scope & Context
I really like how notion handles the default value. For example:
statusin my database in notion.Not startedis the default value.:In progress, all rows that were still using the default value automatically update toIn progress:Not started, that row is now treated as a custom value:Not startedagain, I see all the rows haveNot startedvalue:Done, all rows update their values toDoneexcept for that one row which I explicitly set the value toNot started( Because I changed it's value it no longer accepts default value ):Current behavior
Expected Behaviour:
It should work like Notion:
Technical inputs
I checked the codebase and found that when we create a new custom field it sets the default value is directly written into all rows.
So my first instinct was to update these values whenever we are update the default value. So something like this:
But there is a bug with this one:
In the notion example, if we follow the same steps, in step 4 when we change the default to
Not startedwhen all the rows have this value. After that if we change the default to something else all rows update their value even the row which I explicitly changed the value of.So there is another option: Instead of writing default values directly into every row, we store all new field values as
NULLinitially, and while fetching the data we populate all these null values to the default value. And if we explicitly set a field's value to new value then we update the value from null to this new value and while getting the data we skip populating the fields which have data to default value.I would like to take feedback of the maintainers on this one, as this might change how we store the data.
All reactions