Skip to content

fix(diffs): remove empty <pre> in cleanUp so a StrictMode remount renders - #1219

Merged
amadeus merged 2 commits into
pierrecomputer:mainfrom
arthtyagi:fix/strictmode-stale-pre
Oct 23, 2026
Merged

amadeus merged 2 commits into
pierrecomputer:mainfrom
arthtyagi:fix/strictmode-stale-pre

Conversation

@arthtyagi

@arthtyagi arthtyagi commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Diff view was rendering blank for us under StrictMode with the header off. cleanUp now drops the empty pre so the remount renders.

Motivation & Context

Repro: https://github.com/arthtyagi/pierre-diffs-strictmode-repro (open in StackBlitz: https://stackblitz.com/github/arthtyagi/pierre-diffs-strictmode-repro)

Type of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (repo pre-commit hooks: moon typecheck, oxfmt, oxlint --type-aware)
  • My code is formatted properly
  • I have updated the documentation accordingly (n/a)
  • I have added tests to cover my changes (test/reactStrictMode.test.ts: fails on main, FileDiff 0/6 and File 0/4; passes with the fix)
  • All new and existing tests pass (bun test in packages/diffs: 2440 pass, 0 fail)

How was AI used in generating this PR

Claude Code helped me build the repro and draft the fix + test; I reviewed it and ran the suite.

Related issues

Related: #478, #887

…ders

FileDiff and File left an empty <pre> in the shadow root when cleanUp ran before the highlighter was ready. React StrictMode remounts onto the same container, hydrate() adopted the empty <pre>, and the code stayed blank. cleanUp now removes a <pre> with no children. Adds reactStrictMode.test.ts (fails on main: FileDiff 0/6, File 0/4).
@vercel

vercel Bot commented Oct 23, 2026

Copy link
Copy Markdown

@arthtyagi is attempting to deploy a commit to the Pierre Computer Company Team on Vercel.

A member of the Team first needs to authorize it.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T08:47:10.103481Z dc830c4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@vercel

vercel Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
pierre-diffshub Ready Ready Preview Oct 23, 2026 7:31pm UTC
pierre-docs-diffs Ready Ready Preview Oct 23, 2026 7:31pm UTC
pierre-docs-trees Ready Ready Preview Oct 23, 2026 7:31pm UTC
pierrejs-diff-demo Ready Ready Preview Oct 23, 2026 7:31pm UTC

Request Review

@amadeus

amadeus commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Good catch, and thanks for the PR! I made a few small tweaks to it and added some more tests, cheers!

This branch was successfully deployed

4 active deployments
Preview – pierre-docs-trees — 94f1479c Deployed Oct 23, 2026 by vercel[bot]
Preview – pierre-docs-diffs — 94f1479c Deployed Oct 23, 2026 by vercel[bot]
Preview – pierrejs-diff-demo — 94f1479c Deployed Oct 23, 2026 by vercel[bot]
Preview – pierre-diffshub — 94f1479c Deployed Oct 23, 2026 by vercel[bot]
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