(block: CachedMCEditsBlock)
| 3141 | |
| 3142 | // Helper to deduplicate a cache_edits block against already-seen deletions |
| 3143 | const deduplicateEdits = (block: CachedMCEditsBlock): CachedMCEditsBlock => { |
| 3144 | const uniqueEdits = block.edits.filter(edit => { |
| 3145 | if (seenDeleteRefs.has(edit.cache_reference)) { |
| 3146 | return false |
| 3147 | } |
| 3148 | seenDeleteRefs.add(edit.cache_reference) |
| 3149 | return true |
| 3150 | }) |
| 3151 | return { ...block, edits: uniqueEdits } |
| 3152 | } |
| 3153 | |
| 3154 | // Re-insert all previously-pinned cache_edits at their original positions |
| 3155 | for (const pinned of pinnedEdits ?? []) { |
no test coverage detected