Skip to content

Commit 49ff67f

Browse files
committed
Address Copilot comments
1 parent aa5bfc4 commit 49ff67f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/react/src/reactrouter-compat-utils/instrumentation.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,11 @@ export function processResolvedRoutes(
271271
const windowLocation = WINDOW.location;
272272
if (windowLocation) {
273273
const capturedKey = computeLocationKey(currentLocation);
274-
const currentKey = `${windowLocation.pathname}${windowLocation.search || ''}${windowLocation.hash || ''}`;
274+
const currentKey = computeLocationKey({
275+
pathname: windowLocation.pathname,
276+
search: windowLocation.search || '',
277+
hash: windowLocation.hash || '',
278+
});
275279

276280
if (currentKey !== capturedKey) {
277281
return;

packages/react/test/reactrouter-compat-utils/lazy-routes.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ describe('reactrouter-compat-utils/lazy-routes', () => {
330330
expect(mockProcessResolvedRoutes).toHaveBeenCalledWith(routes, route, mockLocation);
331331
});
332332

333-
it('should pass null location when currentLocation is null', () => {
333+
it('should convert null location to undefined for processResolvedRoutes', () => {
334334
const routes: RouteObject[] = [{ path: '/route1' }];
335335

336336
handleAsyncHandlerResult(routes, route, handlerKey, mockProcessResolvedRoutes, null);

0 commit comments

Comments
 (0)