Skip to content
Source
Sign inSign up
TanStack/virtual

test(react-virtual): add e2e test for React Compiler with directDomUpdates, bump react to 19 #1187

Mergedpiecykmerged 1 commit intomain fromrefs/pull/1187/headmerged by piecyk

piecykcommented

🎯 Changes

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • New Features

    • Upgraded to React 19 support across all examples and core packages
    • Added React Compiler integration with end-to-end testing
  • Bug Fixes

    • Fixed directDomUpdates positioning behavior in position and transform modes
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Review Change Stack

      📝 Walkthrough

      Walkthrough

      React ecosystem upgraded to v19.2.7 across all benchmarks and example applications with corresponding TypeScript type definitions, accompanied by a new React compiler end-to-end regression test suite for validating directDomUpdates behavior in position and transform modes.

      Changes

      React 19 Upgrade

      Layer / File(s)Summary
      Example apps React 19 upgrade
      benchmarks/package.json, examples/react/chat/package.json, examples/react/dynamic/package.json, examples/react/fixed/package.json, examples/react/infinite-scroll/package.json, examples/react/padding/package.json, examples/react/pretext/package.json, examples/react/scroll-padding/package.json, examples/react/smooth-scroll/package.json, examples/react/sticky/package.json, examples/react/table/package.json, examples/react/variable/package.json, examples/react/window/package.json
      React and ReactDOM dependencies bumped from v18.3.1 to v19.2.7 across all example and benchmark package.json files, with corresponding @types/react and @types/react-dom updated to React 19 type versions.
      Library and tool configuration
      packages/react-virtual/package.json, knip.json
      React-virtual package devDependencies upgraded to React 19.x; knip dependency checker configuration updated to ignore babel-plugin-react-compiler.
      Pretext example type compatibility
      examples/react/pretext/src/main.tsx
      The useElementWidth hook's ref parameter type updated from React.RefObject<HTMLElement> to React.RefObject<HTMLElement | null> to reflect nullable ref.current state.

      React Compiler E2E Regression Tests

      Layer / File(s)Summary
      React compiler Vite and test configuration
      packages/react-virtual/e2e/app/react-compiler-vite.config.ts, packages/react-virtual/playwright.config.ts
      New Vite configuration for isolated React compiler e2e builds with babel-plugin-react-compiler targeting React 19; Playwright webServer command extended to build both the standard and compiler-specific vite configs.
      React compiler test application
      packages/react-virtual/e2e/app/react-compiler/index.html, packages/react-virtual/e2e/app/react-compiler/main.tsx
      Test app renders a 1000-item virtualized list with configurable directDomUpdates and positioning modes (position vs transform); exposes control via URL query params and tracks render count for regression validation.
      Playwright test suite for React compiler
      packages/react-virtual/e2e/app/test/react-compiler.spec.ts
      End-to-end tests validate React compiler integration by checking initial render, scrolling to index 500 (issue #736 regression), and incremental scroll behavior with assertions on DOM positioning and render count ≤ 2 per scroll.

      Estimated code review effort

      🎯 2 (Simple) | ⏱️ ~12 minutes

      • TanStack/workflow#11: React and react-dom version pin updates across project package.json files aligned with this PR's dependency upgrade strategy.
      • TanStack/virtual#1178: Updates the Pretext example code; this PR's type fix in examples/react/pretext/src/main.tsx ensures React 19 compatibility for the same file.
      • TanStack/virtual#1168: Previous React upgrade PR affecting benchmarks/package.json and example dependencies; this PR completes the ecosystem-wide upgrade.
      • TanStack/virtual#1185: Documents the directDomUpdates and positioning mode options that this PR's e2e test suite directly validates.

      Poem

      🐰 With whiskers twitching, we hop up high,
      From React eighteen to nineteen we fly!
      Compiler tests bounce from mode to mode,
      Transform and position on the new code road,
      Each scroll and render makes our carrots grow,
      The virtual list now steals the show! 🥕

      🚥 Pre-merge checks | ✅ 3 | ❌ 2

      ❌ Failed checks (1 warning, 1 inconclusive)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
      Description check❓ InconclusiveThe description uses the correct template structure with all required sections, but the 'Changes' section is empty, lacking explanation of what was added and why.Fill in the 'Changes' section with a brief explanation of the e2e test additions and React upgrade motivation.
      ✅ Passed checks (3 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title accurately summarizes the main changes: adding an e2e test for React Compiler with directDomUpdates and upgrading React to v19, which matches the changeset's primary objectives.
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      ✏️ Tip: You can configure your own custom pre-merge checks in the settings.
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    2. nx-cloud[bot](GitHub profile, opens in a new tab)commented

      View your CI Pipeline Execution ↗ for commit 534fa4e9bf079d27ba7b1c62ab8c76f0cb307b2d

      CommandStatusDurationResult
      nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded2m 30sView ↗
      nx run-many --target=build --exclude=examples/**✅ Succeeded16sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-06-02 08:09:12 UTC

    3. Review the following changes in direct dependencies. Learn more about Socket for GitHub.

      Diff Package Supply Chain
      Security
      Vulnerability Quality Maintenance License
      Added@​types/​react-dom@​19.2.31001007585100
      Added@​types/​react@​19.2.161001007995100
      Addedbabel-plugin-react-compiler@​1.0.01001007996100
      Updatedreact@​18.3.1 ⏵ 19.2.7100 +11008497100
      Addedreact-dom@​19.2.71001009298100

      View full report

    4. More templates

      @tanstack/angular-virtual

      npm i https://pkg.pr.new/@tanstack/angular-virtual@1187

      @tanstack/lit-virtual

      npm i https://pkg.pr.new/@tanstack/lit-virtual@1187

      @tanstack/react-virtual

      npm i https://pkg.pr.new/@tanstack/react-virtual@1187

      @tanstack/solid-virtual

      npm i https://pkg.pr.new/@tanstack/solid-virtual@1187

      @tanstack/svelte-virtual

      npm i https://pkg.pr.new/@tanstack/svelte-virtual@1187

      @tanstack/virtual-core

      npm i https://pkg.pr.new/@tanstack/virtual-core@1187

      @tanstack/vue-virtual

      npm i https://pkg.pr.new/@tanstack/vue-virtual@1187

      commit: 534fa4e

    5. 🧹 Nitpick comments (1)
      packages/react-virtual/e2e/app/react-compiler/main.tsx (1)

      73-77: ⚡ Quick win

      Consider adding a comment to clarify the conditional styling logic.

      The triple-nested ternary controlling top and transform is correct but complex. When directDomUpdates is enabled, the virtualizer writes positioning directly to the DOM:

      • mode='transform': virtualizer writes transform: translate3d(...), so we provide top: 0 as a base
      • mode='position': virtualizer writes top: ...px, so we omit it from the initial style

      A brief inline comment would help future maintainers understand why the styles differ by mode.

      🤖 Prompt for AI Agents
      Verify each finding against current code. Fix only still-valid issues, skip the
      rest with a brief reason, keep changes minimal, and validate.
      
      In `@packages/react-virtual/e2e/app/react-compiler/main.tsx` around lines 73 - 77,
      Add a brief inline comment explaining the nested ternary that sets top and
      transform based on directDom (or directDomUpdates) and mode: clarify that when
      directDom is true and mode === 'transform' we set top: 0 because the virtualizer
      will write translate3d to the DOM, whereas when mode === 'position' we omit top
      because the virtualizer will set top directly; likewise note the fallback for
      non-directDom that sets both top: 0 and transform using v.start. Place this
      comment next to the expression that uses directDom, mode, and v.start to make
      the intent clear for future maintainers.
      🤖 Prompt for all review comments with AI agents
      Verify each finding against current code. Fix only still-valid issues, skip the
      rest with a brief reason, keep changes minimal, and validate.
      
      Nitpick comments:
      In `@packages/react-virtual/e2e/app/react-compiler/main.tsx`:
      - Around line 73-77: Add a brief inline comment explaining the nested ternary
      that sets top and transform based on directDom (or directDomUpdates) and mode:
      clarify that when directDom is true and mode === 'transform' we set top: 0
      because the virtualizer will write translate3d to the DOM, whereas when mode ===
      'position' we omit top because the virtualizer will set top directly; likewise
      note the fallback for non-directDom that sets both top: 0 and transform using
      v.start. Place this comment next to the expression that uses directDom, mode,
      and v.start to make the intent clear for future maintainers.

      ℹ️ Review info
      ⚙️ Run configuration

      Configuration used: defaults

      Review profile: CHILL

      Plan: Pro

      Run ID: 6de9e63b-97a8-48b9-9347-555ab33db9fb

      📥 Commits

      Reviewing files that changed from the base of the PR and between b983b21a48dabdb87e7ca36f5f8587d2cc02f837 and 534fa4e9bf079d27ba7b1c62ab8c76f0cb307b2d.

      ⛔ Files ignored due to path filters (1)
      • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
      📒 Files selected for processing (21)
      • benchmarks/package.json
      • examples/react/chat/package.json
      • examples/react/dynamic/package.json
      • examples/react/fixed/package.json
      • examples/react/infinite-scroll/package.json
      • examples/react/padding/package.json
      • examples/react/pretext/package.json
      • examples/react/pretext/src/main.tsx
      • examples/react/scroll-padding/package.json
      • examples/react/smooth-scroll/package.json
      • examples/react/sticky/package.json
      • examples/react/table/package.json
      • examples/react/variable/package.json
      • examples/react/window/package.json
      • knip.json
      • packages/react-virtual/e2e/app/react-compiler-vite.config.ts
      • packages/react-virtual/e2e/app/react-compiler/index.html
      • packages/react-virtual/e2e/app/react-compiler/main.tsx
      • packages/react-virtual/e2e/app/test/react-compiler.spec.ts
      • packages/react-virtual/package.json
      • packages/react-virtual/playwright.config.ts
    6. piecyk merged this932c358

    7. piecyk closed this

Sign in to join this conversation.