Skip to content

test: refactor client-nav benchmarks for flame profiling#6816

Merged
Sheraff merged 3 commits intomainfrom
bench/client-nav-flame-refactor
Mar 3, 2026
Merged

test: refactor client-nav benchmarks for flame profiling#6816
Sheraff merged 3 commits intomainfrom
bench/client-nav-flame-refactor

Conversation

@Sheraff
Copy link
Contributor

@Sheraff Sheraff commented Mar 3, 2026

Summary

  • refactor the React, Solid, and Vue client-nav benchmark harnesses to use shared setup modules and .ts benchmark entries
  • add flame benchmark entrypoints for all three adapters and wire new Nx targets/scripts for test:flame:*
  • switch benchmark perf scripts to production mode, remove React/Solid/Vue testing-library deps, and share a single JSDOM bootstrap at benchmarks/client-nav/jsdom.ts

Summary by CodeRabbit

  • New Features

    • Added flame-based performance profiling for React, Solid, and Vue client-nav benchmarks with 10s flame runs.
    • Benchmarks and scripts now run in production mode for more realistic measurements.
  • Chores

    • Standardized benchmark setup across frameworks with unified before/tick/after lifecycle.
    • Updated benchmarking scripts, test targets, and build/test task wiring to support flame runs and streamlined execution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 3, 2026

📝 Walkthrough

Walkthrough

Refactors benchmarks/client-nav: adds a shared JSDOM environment, replaces .tsx benches with framework-specific setup modules and Vitest bench + flame scripts for React, Solid, and Vue, updates package.json (flame tooling, scripts, NX targets), and adjusts TypeScript configs to include new files.

Changes

Cohort / File(s) Summary
Benchmark Infrastructure
benchmarks/client-nav/README.md, benchmarks/client-nav/jsdom.ts, benchmarks/client-nav/package.json
Added flame-run documentation, introduced jsdom.ts to provision a JSDOM global/window, added @platformatic/flame and @types/jsdom, replaced perf scripts with production-mode vitest bench and flame scripts, and refined NX build/test target deps per framework.
React
benchmarks/client-nav/react/setup.ts, benchmarks/client-nav/react/speed.bench.ts, benchmarks/client-nav/react/speed.flame.ts, benchmarks/client-nav/react/tsconfig.json, benchmarks/client-nav/react/speed.bench.tsx
Added setup() exporting {before,tick,after} using React 18 createRoot; new Vitest bench and 10s flame runner; tsconfig includes new files; removed legacy .tsx bench.
Solid
benchmarks/client-nav/solid/setup.ts, benchmarks/client-nav/solid/speed.bench.ts, benchmarks/client-nav/solid/speed.flame.ts, benchmarks/client-nav/solid/tsconfig.json, benchmarks/client-nav/solid/speed.bench.tsx
Added Solid setup() with router orchestration, new Vitest bench and flame runner, tsconfig updates; removed legacy .tsx bench.
Vue
benchmarks/client-nav/vue/setup.ts, benchmarks/client-nav/vue/speed.bench.ts, benchmarks/client-nav/vue/speed.flame.ts, benchmarks/client-nav/vue/tsconfig.json
Added Vue setup() exposing lifecycle API, new Vitest bench and flame runner, and tsconfig changes to include new test/setup files.
Removed Files
benchmarks/client-nav/react/speed.bench.tsx, benchmarks/client-nav/solid/speed.bench.tsx
Removed older CodSpeed/.tsx benchmark files; replaced by new .ts Vitest and flame variants.

Sequence Diagram(s)

sequenceDiagram
    participant Flame as Flame Runtime
    participant Setup as setup()
    participant Router as Router
    participant Component as Component
    participant Window as JSDOM_Window

    Flame->>Setup: initialize test harness / call setup()
    Setup->>Router: createTestRouter()
    Router-->>Setup: router ready
    Setup->>Component: render app (mount)
    Component-->>Setup: mounted / ready

    Flame->>Setup: test.before()
    activate Setup
    Setup->>Router: subscribe onRendered
    Setup->>Component: ready for ticks
    deactivate Setup

    loop until 10s elapsed
        Flame->>Setup: test.tick()
        activate Setup
        Setup->>Router: navigate to next route
        Router->>Component: trigger render
        Component-->>Router: render complete
        deactivate Setup
    end

    Flame->>Setup: test.after()
    activate Setup
    Setup->>Component: unmount / dispose
    Setup->>Window: cleanup
    Setup->>Window: window.close()
    Window-->>Flame: closed
    deactivate Setup
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested labels

package: react-router, package: solid-router, package: vue-router

Suggested reviewers

  • schiller-manuel

"I hop, I code, I bench with cheer,
React, Solid, Vue now all appear.
JSDOM wheels spin, flame heat's bright,
Ten-second loops across the night.
🐰🔥 — a rabbit's tiny benchmark delight"

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring 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.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: refactoring client-nav benchmarks to support flame profiling, which is the primary objective evident across all file changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bench/client-nav-flame-refactor

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Mar 3, 2026

🤖 Nx Cloud AI Fix Eligible

An automatically generated fix could have helped fix failing tasks for this run, but Self-healing CI is disabled for this workspace. Visit workspace settings to enable it and get automatic fixes in future runs.

To disable these notifications, a workspace admin can disable them in workspace settings.


View your CI Pipeline Execution ↗ for commit ba1a593

Command Status Duration Result
nx run @benchmarks/client-nav:test:perf:solid ❌ Failed 1m 17s View ↗
nx run @benchmarks/ssr:test:perf:vue ✅ Succeeded 2m 9s View ↗
nx run @benchmarks/ssr:test:perf:solid ✅ Succeeded 1m 54s View ↗
nx run @benchmarks/ssr:test:perf:react ✅ Succeeded 2m 3s View ↗
nx run @benchmarks/client-nav:test:perf:vue ✅ Succeeded 1m 24s View ↗
nx run @benchmarks/client-nav:test:perf:react ✅ Succeeded 1m 23s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-03 23:41:55 UTC

@github-actions
Copy link

github-actions bot commented Mar 3, 2026

Bundle Size Benchmarks

  • Commit: 2217f7c3f19f
  • Measured at: 2026-03-03T23:28:18.050Z
  • Baseline source: history:2217f7c3f19f
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Raw Brotli Trend
react-router.minimal 86.58 KiB 0 B (0.00%) 272.45 KiB 75.22 KiB ▅▅▅▅▅▅▅▅▅▅▅
react-router.full 89.61 KiB 0 B (0.00%) 282.78 KiB 77.90 KiB ▅▅▅▅▅▅▅▅▅▅▅
solid-router.minimal 35.88 KiB 0 B (0.00%) 107.56 KiB 32.26 KiB ▅▅▅▅▅▅▅▅▅▅▅
solid-router.full 40.21 KiB 0 B (0.00%) 120.61 KiB 36.13 KiB ▅▅▅▅▅▅▅▅▅▅▅
vue-router.minimal 51.75 KiB 0 B (0.00%) 147.54 KiB 46.50 KiB ▅▅▅▅▅▅▅▅▅▅▅
vue-router.full 56.55 KiB 0 B (0.00%) 163.12 KiB 50.86 KiB ▅▅▅▅▅▅▅▅▅▅▅
react-start.minimal 99.11 KiB 0 B (0.00%) 311.58 KiB 85.68 KiB ▅▅▅▅▅▅▅▅▅▅▅
react-start.full 102.50 KiB 0 B (0.00%) 321.39 KiB 88.63 KiB ▁▁▁████████
solid-start.minimal 48.19 KiB 0 B (0.00%) 145.13 KiB 42.67 KiB ▅▅▅▅▅▅▅▅▅▅▅
solid-start.full 53.68 KiB 0 B (0.00%) 161.08 KiB 47.37 KiB ▁▁▁████████

Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 3, 2026

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@6816

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@6816

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@6816

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@6816

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@6816

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@6816

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@6816

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@6816

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@6816

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@6816

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@6816

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@6816

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@6816

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@6816

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@6816

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@6816

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@6816

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@6816

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@6816

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@6816

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@6816

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@6816

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@6816

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@6816

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@6816

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@6816

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@6816

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@6816

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@6816

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@6816

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@6816

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@6816

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@6816

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@6816

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@6816

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@6816

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@6816

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@6816

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@6816

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@6816

commit: 8f3572d

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
benchmarks/client-nav/package.json (1)

31-42: ⚠️ Potential issue | 🟡 Minor

Remove the unused @testing-library/react dependency.

The PR objectives remove React/Solid/Vue testing-library dependencies, but @testing-library/react (line 34) remains in devDependencies. All benchmark setup files use direct DOM/framework APIs (react-dom/client, solid-js/web, vue) without testing-library patterns. This dependency is unused and should be removed.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@benchmarks/client-nav/package.json` around lines 31 - 42, Remove the unused
`@testing-library/react` entry from the devDependencies block in package.json:
locate the "devDependencies" object and delete the "@testing-library/react"
key/value so only actually used packages (vite, vitest, typescript, framework
plugins like "@vitejs/plugin-react", "vite-plugin-solid", etc.) remain.
🧹 Nitpick comments (4)
benchmarks/client-nav/solid/speed.flame.ts (1)

15-18: Ensure window.close() always runs on teardown errors.

Line 16 can throw and skip Line 17. Use nested try/finally so JSDOM cleanup is guaranteed.

♻️ Proposed cleanup hardening
 } finally {
-  test.after()
-  window.close()
+  try {
+    await test.after()
+  } finally {
+    window.close()
+  }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@benchmarks/client-nav/solid/speed.flame.ts` around lines 15 - 18, The
teardown currently calls test.after() and then window.close() in a single
finally block so if test.after() throws, window.close() may be skipped; change
to a nested try/finally where you call test.after() inside an inner try and call
window.close() in that inner finally (or vice versa) so window.close() is
guaranteed to run even when test.after() throws; locate the block containing
test.after() and window.close() and wrap test.after() in its own try/finally to
ensure window.close() always executes.
benchmarks/client-nav/vue/speed.flame.ts (1)

15-18: Harden final cleanup ordering.

On Line 16, an exception from test.after() prevents window.close() on Line 17. Make close run in an inner finally.

♻️ Proposed cleanup hardening
 } finally {
-  test.after()
-  window.close()
+  try {
+    await test.after()
+  } finally {
+    window.close()
+  }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@benchmarks/client-nav/vue/speed.flame.ts` around lines 15 - 18, The finally
block can abort window.close() if test.after() throws; change the cleanup so
test.after() is called in an outer try and window.close() in an inner finally
(i.e., call test.after() inside a try { test.after() } finally { window.close()
}) so that window.close() always runs even when test.after() throws; update the
block around test.after() and window.close() accordingly.
benchmarks/client-nav/react/speed.flame.ts (1)

15-18: Make window cleanup unconditional.

If test.after() throws on Line 16, Line 17 won’t run, leaving JSDOM resources open. Wrap test.after() so window.close() always executes.

♻️ Proposed cleanup hardening
 } finally {
-  test.after()
-  window.close()
+  try {
+    await test.after()
+  } finally {
+    window.close()
+  }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@benchmarks/client-nav/react/speed.flame.ts` around lines 15 - 18, The finally
block currently calls test.after() then window.close() so if test.after() throws
the window won't be closed; change the finally to capture any error from
test.after() (e.g., let afterErr), call test.after() inside a try/catch that
stores the error, always call window.close() in the finally, and rethrow
afterErr if present so cleanup is unconditional; reference the existing
test.after() and window.close() calls when making the change.
benchmarks/client-nav/solid/setup.ts (1)

1-3: Fix import ordering per ESLint rules.

The static analysis indicates that the solid-js/web runtime import should occur before the type-only import of @tanstack/router-core.

♻️ Proposed fix for import order
+import { render } from 'solid-js/web'
 import type { NavigateOptions } from '@tanstack/router-core'
-import { render } from 'solid-js/web'
 import type * as App from './app'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@benchmarks/client-nav/solid/setup.ts` around lines 1 - 3, Reorder the imports
so runtime import comes before type-only imports: place the "import { render }
from 'solid-js/web'" line above the "import type { NavigateOptions } from
'@tanstack/router-core'" line; keep the "import type * as App from './app'" type
import wherever appropriate (after runtime import is fine) to satisfy ESLint
import-order rules and preserve the same imported symbols (NavigateOptions,
render, App).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@benchmarks/client-nav/react/setup.ts`:
- Around line 14-16: The router and component are being created once at module
scope via createTestRouter() (variables router and component), causing reuse
across benchmark iterations; move the createTestRouter() call into the setup
lifecycle (match Solid/Vue) so each iteration gets a fresh router: declare let
router and component (and keep id/root as needed) at top, then call ({ router,
component } = createTestRouter()) inside the before/setup function (e.g.,
beforeEach or before), ensuring any existing references in functions like
setup() use the newly assigned router/component for each run.

In `@benchmarks/client-nav/README.md`:
- Line 31: Update the README text that currently reads "10 second loop" to use a
hyphenated compound modifier by changing it to "10-second loop" in the sentence
"Run framework-specific flame benchmarks (10 second loop, profiled with
`@platformatic/flame`, forced to `NODE_ENV=production`)" so the phrase becomes
"10-second loop" for correct grammar.

---

Outside diff comments:
In `@benchmarks/client-nav/package.json`:
- Around line 31-42: Remove the unused `@testing-library/react` entry from the
devDependencies block in package.json: locate the "devDependencies" object and
delete the "@testing-library/react" key/value so only actually used packages
(vite, vitest, typescript, framework plugins like "@vitejs/plugin-react",
"vite-plugin-solid", etc.) remain.

---

Nitpick comments:
In `@benchmarks/client-nav/react/speed.flame.ts`:
- Around line 15-18: The finally block currently calls test.after() then
window.close() so if test.after() throws the window won't be closed; change the
finally to capture any error from test.after() (e.g., let afterErr), call
test.after() inside a try/catch that stores the error, always call
window.close() in the finally, and rethrow afterErr if present so cleanup is
unconditional; reference the existing test.after() and window.close() calls when
making the change.

In `@benchmarks/client-nav/solid/setup.ts`:
- Around line 1-3: Reorder the imports so runtime import comes before type-only
imports: place the "import { render } from 'solid-js/web'" line above the
"import type { NavigateOptions } from '@tanstack/router-core'" line; keep the
"import type * as App from './app'" type import wherever appropriate (after
runtime import is fine) to satisfy ESLint import-order rules and preserve the
same imported symbols (NavigateOptions, render, App).

In `@benchmarks/client-nav/solid/speed.flame.ts`:
- Around line 15-18: The teardown currently calls test.after() and then
window.close() in a single finally block so if test.after() throws,
window.close() may be skipped; change to a nested try/finally where you call
test.after() inside an inner try and call window.close() in that inner finally
(or vice versa) so window.close() is guaranteed to run even when test.after()
throws; locate the block containing test.after() and window.close() and wrap
test.after() in its own try/finally to ensure window.close() always executes.

In `@benchmarks/client-nav/vue/speed.flame.ts`:
- Around line 15-18: The finally block can abort window.close() if test.after()
throws; change the cleanup so test.after() is called in an outer try and
window.close() in an inner finally (i.e., call test.after() inside a try {
test.after() } finally { window.close() }) so that window.close() always runs
even when test.after() throws; update the block around test.after() and
window.close() accordingly.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2217f7c and 1c68dd9.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (17)
  • benchmarks/client-nav/README.md
  • benchmarks/client-nav/jsdom.ts
  • benchmarks/client-nav/package.json
  • benchmarks/client-nav/react/setup.ts
  • benchmarks/client-nav/react/speed.bench.ts
  • benchmarks/client-nav/react/speed.bench.tsx
  • benchmarks/client-nav/react/speed.flame.ts
  • benchmarks/client-nav/react/tsconfig.json
  • benchmarks/client-nav/solid/setup.ts
  • benchmarks/client-nav/solid/speed.bench.ts
  • benchmarks/client-nav/solid/speed.bench.tsx
  • benchmarks/client-nav/solid/speed.flame.ts
  • benchmarks/client-nav/solid/tsconfig.json
  • benchmarks/client-nav/vue/setup.ts
  • benchmarks/client-nav/vue/speed.bench.ts
  • benchmarks/client-nav/vue/speed.flame.ts
  • benchmarks/client-nav/vue/tsconfig.json
💤 Files with no reviewable changes (2)
  • benchmarks/client-nav/react/speed.bench.tsx
  • benchmarks/client-nav/solid/speed.bench.tsx

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b996126da1

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"@vitejs/plugin-react": "^4.3.4",
"@vitejs/plugin-vue": "^5.2.3",
"@vitejs/plugin-vue-jsx": "^4.1.2",
"@types/jsdom": "28.0.0",

Choose a reason for hiding this comment

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

P2 Badge Declare jsdom runtime dependency for flame benchmarks

The new flame harness now imports jsdom at runtime (benchmarks/client-nav/jsdom.ts), but this package only adds @types/jsdom here and never declares jsdom itself. This works only as long as a parent workspace happens to provide jsdom; in filtered/isolated installs (for example, running only @benchmarks/client-nav tasks) the flame scripts can fail with ERR_MODULE_NOT_FOUND when loading ../jsdom.ts.

Useful? React with 👍 / 👎.

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 3, 2026

Merging this PR will not alter performance

✅ 3 untouched benchmarks
🆕 2 new benchmarks
⏩ 2 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 client-side navigation loop (vue) N/A 64.9 ms N/A
🆕 client-side navigation loop (react) N/A 77.7 ms N/A

Comparing bench/client-nav-flame-refactor (ba1a593) with main (2217f7c)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@benchmarks/client-nav/solid/setup.ts`:
- Around line 1-2: The imports are out of order per ESLint import/order: move
the value import "render" so it appears before the type-only import
"NavigateOptions"; update the import statements involving NavigateOptions and
render in benchmarks/client-nav/solid/setup.ts so the line importing render from
'solid-js/web' is placed above the line importing type { NavigateOptions } from
'@tanstack/router-core'.
- Line 49: Remove the unnecessary "as any" cast from the render call: update the
dispose assignment that calls render(() => component() as any, container) to
call render(() => component(), container) so the RouterProvider element returned
by component() keeps its proper typing; modify the expression where dispose is
assigned (the render(...) call using component() and container) to drop the cast
and rely on existing types.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c68dd9 and ba1a593.

📒 Files selected for processing (3)
  • benchmarks/client-nav/react/setup.ts
  • benchmarks/client-nav/solid/setup.ts
  • benchmarks/client-nav/vue/setup.ts
✅ Files skipped from review due to trivial changes (1)
  • benchmarks/client-nav/react/setup.ts

Comment on lines +1 to +2
import type { NavigateOptions } from '@tanstack/router-core'
import { render } from 'solid-js/web'
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix import order to satisfy ESLint import/order.

Line 2 should be ordered before the type import on Line 1 to match the enforced rule.

Suggested diff
-import type { NavigateOptions } from '@tanstack/router-core'
 import { render } from 'solid-js/web'
+import type { NavigateOptions } from '@tanstack/router-core'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import type { NavigateOptions } from '@tanstack/router-core'
import { render } from 'solid-js/web'
import { render } from 'solid-js/web'
import type { NavigateOptions } from '@tanstack/router-core'
🧰 Tools
🪛 ESLint

[error] 2-2: solid-js/web import should occur before type import of @tanstack/router-core

(import/order)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@benchmarks/client-nav/solid/setup.ts` around lines 1 - 2, The imports are out
of order per ESLint import/order: move the value import "render" so it appears
before the type-only import "NavigateOptions"; update the import statements
involving NavigateOptions and render in benchmarks/client-nav/solid/setup.ts so
the line importing render from 'solid-js/web' is placed above the line importing
type { NavigateOptions } from '@tanstack/router-core'.


container = document.createElement('div')
document.body.append(container)
dispose = render(() => component() as any, container)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find and examine the typing of component and createTestRouter
rg -n -C3 'export function createTestRouter|component' benchmarks/client-nav/solid/app.ts benchmarks/client-nav/solid/setup.ts

Repository: TanStack/router

Length of output: 1098


🏁 Script executed:

#!/bin/bash
# Find createTestRouter definition
rg -n 'export.*createTestRouter|function createTestRouter' benchmarks/client-nav/solid/

Repository: TanStack/router

Length of output: 134


🏁 Script executed:

#!/bin/bash
# Read the createTestRouter function implementation
cat -n benchmarks/client-nav/solid/app.tsx | sed -n '83,150p'

Repository: TanStack/router

Length of output: 463


🏁 Script executed:

#!/bin/bash
# Check imports and render usage in setup.ts
head -n 30 benchmarks/client-nav/solid/setup.ts

Repository: TanStack/router

Length of output: 1055


🏁 Script executed:

#!/bin/bash
# Check if there are type issues or if RouterProvider might not be properly typed
# Look for imports and RouterProvider definition
rg -n 'RouterProvider|from.*router' benchmarks/client-nav/solid/app.tsx | head -20

Repository: TanStack/router

Length of output: 177


🏁 Script executed:

#!/bin/bash
# Check TypeScript configuration for the benchmark
find benchmarks/client-nav/solid -name "tsconfig.json" -o -name "tsconfig*.json"

Repository: TanStack/router

Length of output: 100


🏁 Script executed:

#!/bin/bash
# Check TypeScript configuration
cat -n benchmarks/client-nav/solid/tsconfig.json

Repository: TanStack/router

Length of output: 546


🏁 Script executed:

#!/bin/bash
# Check package.json to see `@tanstack/solid-router` version and typing
cat benchmarks/client-nav/solid/package.json 2>/dev/null || \
cat package.json | grep -A 5 -B 5 "solid-router"

Repository: TanStack/router

Length of output: 990


🏁 Script executed:

#!/bin/bash
# Check RouterProvider typing in solid-router
rg -n 'export.*RouterProvider|const RouterProvider' packages/solid-router/src/ -A 5

Repository: TanStack/router

Length of output: 1115


🏁 Script executed:

#!/bin/bash
# Check what solid-js/web render expects
rg -n 'function render|export.*render' packages/ -A 3 | grep -A 3 'solid-js/web' | head -20

Repository: TanStack/router

Length of output: 41


🏁 Script executed:

#!/bin/bash
# Let's check the actual render signature expectations by looking at how 
# Solid typically types render and what component type it expects
# Also check if there are other uses of render in the codebase without `as any`
rg -n 'render\(' benchmarks/client-nav/solid/ --type ts --type tsx

Repository: TanStack/router

Length of output: 86


🏁 Script executed:

#!/bin/bash
# Check other render usages in benchmarks and e2e tests
rg -n 'render\(' benchmarks/ e2e/ -A 1 | head -40

Repository: TanStack/router

Length of output: 2649


🏁 Script executed:

#!/bin/bash
# Let's verify the complete setup.ts context around line 49
sed -n '45,55p' benchmarks/client-nav/solid/setup.ts

Repository: TanStack/router

Length of output: 295


🏁 Script executed:

#!/bin/bash
# Let's check the full app.tsx context to see component definition and any type annotations
sed -n '1,100p' benchmarks/client-nav/solid/app.tsx | head -100

Repository: TanStack/router

Length of output: 1829


Remove as any from the render call to strengthen type safety.

Line 49 uses as any unnecessarily. Since component() returns a properly-typed RouterProvider element from @tanstack/solid-router, and other similar code in the codebase (e.g., e2e/solid-router/ and benchmarks/bundle-size/ files) calls render() without this cast, the type cast can be safely removed:

dispose = render(() => component(), container)

This improves type safety in the benchmark harness and aligns with the guideline for strict-mode type checking in TypeScript files.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@benchmarks/client-nav/solid/setup.ts` at line 49, Remove the unnecessary "as
any" cast from the render call: update the dispose assignment that calls
render(() => component() as any, container) to call render(() => component(),
container) so the RouterProvider element returned by component() keeps its
proper typing; modify the expression where dispose is assigned (the render(...)
call using component() and container) to drop the cast and rely on existing
types.

@Sheraff Sheraff merged commit 7083bcb into main Mar 3, 2026
10 checks passed
@Sheraff Sheraff deleted the bench/client-nav-flame-refactor branch March 3, 2026 23:44
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.

1 participant