MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / commitCell

Function commitCell

packages/app-core/src/components/DatabaseTableView.tsx:120–135  ·  view source on GitHub ↗
(rowId: string, field: DbField, value: string)

Source from the content-addressed store, hash-verified

118 }
119
120 const commitCell = (rowId: string, field: DbField, value: string): void => {
121 if (field.type === 'select' || field.type === 'multiSelect') {
122 // Ensure each chosen value exists as an option (schema), then set the cell.
123 let next = doc
124 const values = field.type === 'multiSelect' ? splitMultiSelect(value) : value ? [value] : []
125 for (const v of values) next = ensureSelectOption(next, field.id, v)
126 next = setCell(next, rowId, field.id, value)
127 updateDatabaseSchema(csvPath, next)
128 } else {
129 updateDatabaseRows(csvPath, setCell(doc, rowId, field.id, value))
130 }
131 // Keep the linked page note's filename in step with the title field.
132 if (field.id === titleFieldId && doc.pages?.[rowId]) {
133 void renameRecordPage(csvPath, rowId)
134 }
135 }
136
137 // Keep the active cell within bounds as rows/columns change.
138 useEffect(() => {

Callers 2

toggleCheckboxFunction · 0.85
DatabaseTableViewFunction · 0.85

Calls 3

ensureSelectOptionFunction · 0.90
setCellFunction · 0.90
splitMultiSelectFunction · 0.85

Tested by

no test coverage detected