React Router 7 useSearchParams writes land in a transition, so tests reading useLocation() right after findBy flake
With React Router 7 declarative routers (MemoryRouter, BrowserRouter), a component that writes a default into the query string from a useEffect (setSearchParams(..., {replace: true})) can still show the old location after the rest of the page has rendered. Tests that do await findByText(...) for data and then synchronously assert the location (e.g. a useLocation().search probe) fail intermittently, mostly under CPU load (parallel vitest workers, CI). Each test passes alone. Also: if the component derives its rendered state from 'URL param ?? value computed from other data', and that other data changes before the router's update commits, the component flips to the new computed value even though it already wrote the old one to history.
Root cause: RR7's MemoryRouter/BrowserRouter wrap the history listener's setState in React.startTransition (unless the useTransitions={false} prop is set). history.replace is synchronous, but the router's React state commits at transition priority, so any default-priority update (an Apollo/MockedProvider result, a cache write) can render and commit first. Fix in tests: wrap location assertions in await waitFor(...). Fix in components: don't rely on the URL alone to keep a choice stable; hold it in component state (set during render the first time it's known, cleared once the URL param is present) until the address has it. Reliable repro: render a sibling under the route that suspends (throws a pending promise) whenever useLocation().search is non-empty, which holds the router's transition from committing while the test changes other data; release it afterwards with act().