Skip to content

Conversation

@birkskyum
Copy link
Member

@birkskyum birkskyum commented Oct 25, 2025

Summary by CodeRabbit

  • Tests
    • Re-enabled a previously skipped test and enhanced its reliability with improved synchronization mechanisms to ensure proper validation of routing functionality and data consistency.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 25, 2025

Walkthrough

A previously skipped test "reproducer #4546" is enabled and enhanced with explicit synchronization points. Navigation completions and route data checks are awaited to ensure loader and data updates are reflected before assertions run.

Changes

Cohort / File(s) Summary
Test enablement and synchronization
packages/solid-router/tests/loaders.test.tsx
Converts test.skip to test for "reproducer #4546". Adds await points for navigation completion (text verification) and route data updates (short delay after invalidation) to ensure proper test synchronization.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5-10 minutes

  • Verify that the test was appropriately skipped previously and enabling it is correct
  • Confirm the synchronization strategy (text await + delay) is sufficient for reliable test execution
  • Check that the test assertions properly validate the loader behavior after the added sync points

Suggested labels

package: solid-router

Suggested reviewers

  • schiller-manuel

Poem

🐰 A test once hidden, now sees the light,
With awaits in place, it gets it right.
Navigation waits, and loaders bloom,
No more skipped assertions doom the room! ✨

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "test(solid-router): fix timing in loaders test" clearly and accurately reflects the main change in the pull request. The changeset focuses on fixing timing issues in loader tests by adding explicit synchronization points and enabling a previously skipped test. The title is specific, using conventional format with type and scope, and directly communicates the primary objective without being vague or misleading. While the title doesn't enumerate all implementation details (like enabling the skipped test or the specific synchronization technique), this is appropriate and expected for a PR title that should highlight the most important change rather than list every modification.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test(solid-router)--fix-timing-in-loaders-test

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.

@nx-cloud
Copy link

nx-cloud bot commented Oct 25, 2025

View your CI Pipeline Execution ↗ for commit 3f63c79

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 2m 39s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2025-10-25 22:23:37 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 25, 2025

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5622

@tanstack/directive-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5622

@tanstack/eslint-plugin-router

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

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5622

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5622

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5622

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5622

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/server-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5622

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5622

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5622

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5622

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5622

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5622

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5622

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5622

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5622

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5622

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5622

commit: 3f63c79

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: 0

🧹 Nitpick comments (1)
packages/solid-router/tests/loaders.test.tsx (1)

607-608: Consider using waitFor for more robust synchronization.

The fixed 50ms timeout could be flaky on slower systems and doesn't verify that the state actually changed. Consider using waitFor to poll for the expected counter value instead:

+import { cleanup, fireEvent, render, screen, waitFor } from '@solidjs/testing-library'

Then replace the timeout:

-  // Wait for router to invalidate and reload
-  await new Promise((resolve) => setTimeout(resolve, 50))
-  const headerCounter = await screen.findByTestId('header-counter')
-  expect(headerCounter).toHaveTextContent('4')
+  // Wait for router to invalidate and reload
+  await waitFor(() => {
+    const headerCounter = screen.getByTestId('header-counter')
+    expect(headerCounter).toHaveTextContent('4')
+  })

This polls until the condition is met rather than relying on an arbitrary delay.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b5c96d4 and 3f63c79.

📒 Files selected for processing (1)
  • packages/solid-router/tests/loaders.test.tsx (5 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript in strict mode with extensive type safety across the codebase

Files:

  • packages/solid-router/tests/loaders.test.tsx
packages/{react-router,solid-router}/**

📄 CodeRabbit inference engine (AGENTS.md)

Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/

Files:

  • packages/solid-router/tests/loaders.test.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Preview
  • GitHub Check: Test
🔇 Additional comments (2)
packages/solid-router/tests/loaders.test.tsx (2)

405-405: Good fix - enabling the previously skipped test.

Enabling this test with proper synchronization points improves test coverage and validates the fix for issue #4546.


577-578: LGTM - proper navigation synchronization.

Awaiting route-specific text before assertions ensures navigation and rendering completes, making the test more reliable.

Also applies to: 592-593, 622-623

@birkskyum birkskyum merged commit 735c1e3 into main Oct 25, 2025
6 checks passed
@birkskyum birkskyum deleted the test(solid-router)--fix-timing-in-loaders-test branch October 25, 2025 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants