MCPcopy
hub / github.com/drawdb-io/drawdb / updateField

Function updateField

src/context/DiagramContext.jsx:161–183  ·  view source on GitHub ↗
(tid, fid, updatedValues)

Source from the content-addressed store, hash-verified

159 };
160
161 const updateField = (tid, fid, updatedValues) => {
162 setTables((prev) =>
163 prev.map((table) => {
164 if (tid === table.id) {
165 return {
166 ...table,
167 fields: table.fields.map((field) =>
168 fid === field.id ? { ...field, ...updatedValues } : field,
169 ),
170 };
171 }
172 return table;
173 }),
174 );
175 if (shouldEmit()) {
176 emitDelta({
177 target: "table",
178 action: "update",
179 entityId: tid,
180 data: [tid, fid, updatedValues],
181 });
182 }
183 };
184
185 const deleteField = (field, tid, addToHistory = true) => {
186 const { fields, name } = tables.find((t) => t.id === tid);

Callers 6

undoFunction · 0.85
redoFunction · 0.85
TypeInfoFunction · 0.85
TableFieldFunction · 0.85
FieldDetailsFunction · 0.85
EnumDetailsFunction · 0.85

Calls 1

shouldEmitFunction · 0.70

Tested by

no test coverage detected