fix: virtualization on FileDiffs hydration flow#479
Merged
amadeus merged 2 commits intopierrecomputer:mainfrom Apr 5, 2026
Merged
fix: virtualization on FileDiffs hydration flow#479amadeus merged 2 commits intopierrecomputer:mainfrom
amadeus merged 2 commits intopierrecomputer:mainfrom
Conversation
|
@ShpetimA is attempting to deploy a commit to the Pierre Computer Company Team on Vercel. A member of the Team first needs to authorize it. |
Member
|
Ahh thanks for the report, good catch. Although a couple notes:
diff --git a/packages/diffs/src/components/File.ts b/packages/diffs/src/components/File.ts
index efd8b0f7..25b372c2 100644
--- a/packages/diffs/src/components/File.ts
+++ b/packages/diffs/src/components/File.ts
@@ -334,7 +334,9 @@ export class File<LAnnotation = undefined> {
this.syncCodeNodeFromPre(this.pre);
this.pre.removeAttribute('data-dehydrated');
}
- this.fileContainer = fileContainer;
+ if (this.pre != null || this.headerElement != null) {
+ this.fileContainer = fileContainer;
+ }
}
protected hydrationSetup({
diff --git a/packages/diffs/src/components/FileDiff.ts b/packages/diffs/src/components/FileDiff.ts
index 81c31fc2..5162d15d 100644
--- a/packages/diffs/src/components/FileDiff.ts
+++ b/packages/diffs/src/components/FileDiff.ts
@@ -500,7 +500,6 @@ export class FileDiff<LAnnotation = undefined> {
}
// Otherwise orchestrate our setup
else {
- this.fileContainer = fileContainer;
this.hydrationSetup({
fileDiff,
oldFile,
@@ -571,6 +570,9 @@ export class FileDiff<LAnnotation = undefined> {
this.syncCodeNodesFromPre(this.pre);
this.pre.removeAttribute('data-dehydrated');
}
+ if (this.pre != null || this.headerElement != null) {
+ this.fileContainer = fileContainer;
+ }
}
protected hydrationSetup({I tested it with your repro and it appeared to fix the problem but I also think ensure the assignment is happening properly |
Contributor
Author
|
Updated the pr with the suggested patch now both File.ts and FileDiff are good |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Member
|
Thanks for finding the issue, reporting and fixing! 🙏 |
2 tasks
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
As described #478 the virtualization step in React Filediffs appears blank on first render
Motivation & Context
Move host-container assignment out of the generic DOM scan and into the real hydration branch only. Empty mounts should leave this.fileContainer unset until the first render() call.
The fix:
Fix.mov
Type of changes
first discussed with the dev team and they should be aware that this PR is
being opened
You must have first discussed with the dev team and they should be aware
that this PR is being opened
Checklist
contributing guidelines
bun run lint)bun run format)bun run diffs:test)How was AI used in generating this PR
AI was used to pinpoint the regression from v1.1.5 - v1.1.6 and reproduce the issue
Related issues
#478