Skip to content

Conversation

@amadeus
Copy link
Member

@amadeus amadeus commented Dec 22, 2025

lol whoopsies, classic lil order of operations shenanery.

Basically the bug was that because we were populating the renderCache AFTER we made a call to getRenderOptions, which in turn would return forceRender: true if renderCache was empty.

So the fix here is to fix here is to attempt to create renderCache from cache if it exists, then allow the forceRender to compute its thing if necessary.

@vercel
Copy link

vercel bot commented Dec 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
pierrejs-diff-demo Ready Ready Preview Dec 22, 2025 11:48pm
pierrejs-docs Ready Ready Preview Dec 22, 2025 11:48pm
pierrejs-solid-diff-demo Ready Ready Preview Dec 22, 2025 11:48pm

lol whoopsies, classic lil order of operations shenanery.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a cache hydration bug in the worker pool implementation where render options were being evaluated before the render cache was populated, causing unnecessary re-renders even when valid cached results existed.

  • Reordered cache population to occur before getRenderOptions call, allowing proper cache detection
  • Simplified the fallback renderCache initialization logic
  • Applied the same fix pattern to both FileRenderer and DiffHunksRenderer

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/diffs/src/renderers/FileRenderer.ts Fixed cache hydration order in renderFile method to prevent false positive forceRender triggers
packages/diffs/src/renderers/DiffHunksRenderer.ts Fixed cache hydration order in renderDiff method with identical pattern as FileRenderer

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pierrecomputer pierrecomputer deleted a comment from vercel bot Dec 22, 2025
@pierrecomputer pierrecomputer deleted a comment from vercel bot Dec 22, 2025
@amadeus amadeus merged commit c1d2d00 into main Dec 22, 2025
15 checks passed
@amadeus amadeus deleted the amadeus/fix-worker-cache-bug branch December 22, 2025 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants