Removes the given column-id keys from a metadata blob (widths/order/pinned).
( metadata: TableMetadata | null, ids: ReadonlySet<string> )
| 213 | |
| 214 | /** Removes the given column-id keys from a metadata blob (widths/order/pinned). */ |
| 215 | function stripColumnIdsFromMetadata( |
| 216 | metadata: TableMetadata | null, |
| 217 | ids: ReadonlySet<string> |
| 218 | ): TableMetadata | null { |
| 219 | if (!metadata) return metadata |
| 220 | let next = metadata |
| 221 | if (metadata.columnWidths) { |
| 222 | const widths = { ...metadata.columnWidths } |
| 223 | let changed = false |
| 224 | for (const id of ids) |
| 225 | if (id in widths) { |
| 226 | delete widths[id] |
| 227 | changed = true |
| 228 | } |
| 229 | if (changed) next = { ...next, columnWidths: widths } |
| 230 | } |
| 231 | if (metadata.columnOrder?.some((id) => ids.has(id))) { |
| 232 | next = { ...next, columnOrder: metadata.columnOrder.filter((id) => !ids.has(id)) } |
| 233 | } |
| 234 | if (metadata.pinnedColumns?.some((id) => ids.has(id))) { |
| 235 | next = { ...next, pinnedColumns: metadata.pinnedColumns.filter((id) => !ids.has(id)) } |
| 236 | } |
| 237 | return next |
| 238 | } |
| 239 | |
| 240 | /** |
| 241 | * Fire-and-forget reclamation of a deleted column's row storage. The column is |
no outgoing calls
no test coverage detected