Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: router should have 'pending' when loaders in progress (draft) #2790

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

lislon
Copy link
Contributor

@lislon lislon commented Nov 17, 2024

The router had a state idle, while the load and beforeLoad was not resolved.

I noticed this in tests, when I attempted to fix the warning

Warning: An update to Transitioner inside a test was not wrapped in act(...).

by waiting for state = idle.

I also noticed that Transitionier warning happens in afterEach, so I've added a unsubscribe method for history:

afterEach(() => {
  vi.resetAllMocks()
  window.history.replaceState(null, 'root', '/') <-- also causes 'Warning: An update to Transitioner inside a test was not wrapped in act(...).'

Should I expand this approach for other tests?

Copy link

nx-cloud bot commented Nov 17, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 85c5502. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


🟥 Failed Commands
nx affected --targets=test:eslint,test:unit,test:e2e,test:types,test:build,build --parallel=3
✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Copy link

pkg-pr-new bot commented Nov 17, 2024

Open in Stackblitz

More templates

@tanstack/arktype-adapter

pnpm add https://pkg.pr.new/@tanstack/arktype-adapter@2790

@tanstack/create-router

pnpm add https://pkg.pr.new/@tanstack/create-router@2790

@tanstack/history

pnpm add https://pkg.pr.new/@tanstack/history@2790

@tanstack/eslint-plugin-router

pnpm add https://pkg.pr.new/@tanstack/eslint-plugin-router@2790

@tanstack/react-cross-context

pnpm add https://pkg.pr.new/@tanstack/react-cross-context@2790

@tanstack/react-router

pnpm add https://pkg.pr.new/@tanstack/react-router@2790

@tanstack/react-router-with-query

pnpm add https://pkg.pr.new/@tanstack/react-router-with-query@2790

@tanstack/router-cli

pnpm add https://pkg.pr.new/@tanstack/router-cli@2790

@tanstack/router-devtools

pnpm add https://pkg.pr.new/@tanstack/router-devtools@2790

@tanstack/router-generator

pnpm add https://pkg.pr.new/@tanstack/router-generator@2790

@tanstack/router-plugin

pnpm add https://pkg.pr.new/@tanstack/router-plugin@2790

@tanstack/router-vite-plugin

pnpm add https://pkg.pr.new/@tanstack/router-vite-plugin@2790

@tanstack/start

pnpm add https://pkg.pr.new/@tanstack/start@2790

@tanstack/start-vite-plugin

pnpm add https://pkg.pr.new/@tanstack/start-vite-plugin@2790

@tanstack/valibot-adapter

pnpm add https://pkg.pr.new/@tanstack/valibot-adapter@2790

@tanstack/virtual-file-routes

pnpm add https://pkg.pr.new/@tanstack/virtual-file-routes@2790

@tanstack/zod-adapter

pnpm add https://pkg.pr.new/@tanstack/zod-adapter@2790

commit: 85c5502

@lislon lislon force-pushed the router-should-show-pending-when-loaders-in-progress branch from 8f21dad to 17c459c Compare November 17, 2024 20:25
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