(block: CachedMCEditsBlock)
| 3114 | |
| 3115 | // Helper to deduplicate a cache_edits block against already-seen deletions |
| 3116 | const deduplicateEdits = (block: CachedMCEditsBlock): CachedMCEditsBlock => { |
| 3117 | const uniqueEdits = block.edits.filter(edit => { |
| 3118 | if (seenDeleteRefs.has(edit.cache_reference)) { |
| 3119 | return false |
| 3120 | } |
| 3121 | seenDeleteRefs.add(edit.cache_reference) |
| 3122 | return true |
| 3123 | }) |
| 3124 | return { ...block, edits: uniqueEdits } |
| 3125 | } |
| 3126 | |
| 3127 | // Re-insert all previously-pinned cache_edits at their original positions |
| 3128 | for (const pinned of pinnedEdits ?? []) { |
no test coverage detected