( result: RenderResult | undefined, projection: Projection | undefined, cacheKey: string | undefined, owner: string, )
| 515 | } |
| 516 | |
| 517 | function pendingBlocks( |
| 518 | result: RenderResult | undefined, |
| 519 | projection: Projection | undefined, |
| 520 | cacheKey: string | undefined, |
| 521 | owner: string, |
| 522 | ) { |
| 523 | if (!result) return [] |
| 524 | if (!projection || result.text === projection.text) return result.blocks |
| 525 | const initial = result.blocks.length === 1 && result.blocks[0]?.key === "initial" |
| 526 | return projection.blocks.map((block, index) => { |
| 527 | const current = initial ? undefined : result.blocks[index] |
| 528 | if (current && canReusePendingBlock(current, block)) return current |
| 529 | const key = markdownBlockKey(owner, cacheKey, index, block.mode) |
| 530 | if (block.mode !== "code") |
| 531 | return { key, mode: block.mode, raw: block.raw, hash: String(block.raw.length), html: fallback(block.src) } |
| 532 | return { |
| 533 | key, |
| 534 | mode: block.mode, |
| 535 | raw: block.raw, |
| 536 | hash: String(block.raw.length), |
| 537 | language: block.language ?? "text", |
| 538 | complete: !!block.complete, |
| 539 | stable: [], |
| 540 | generation: 0, |
| 541 | unstable: [[block.src, ""] as MarkdownToken], |
| 542 | } |
| 543 | }) |
| 544 | } |
| 545 | |
| 546 | function disposeCode(key: string) { |
| 547 | disposeStreamingCode(key) |
no test coverage detected