Skip to content

Commit 3d6610b

Browse files
committed
No need to shallow-clone location
1 parent 294ba97 commit 3d6610b

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

packages/router/src/active-route-loader.tsx

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const ActiveRouteLoader = ({
8181
[path]: {
8282
page: ArlNullPage,
8383
state: 'PRE_SHOW',
84-
location: { ...location },
84+
location,
8585
},
8686
}))
8787

@@ -96,7 +96,7 @@ export const ActiveRouteLoader = ({
9696
[path]: {
9797
page: whileLoadingPage || ArlWhileLoadingNullPage,
9898
state: 'SHOW_LOADING',
99-
location: { ...location },
99+
location,
100100
},
101101
}))
102102
setRenderedChildren(children)
@@ -120,7 +120,7 @@ export const ActiveRouteLoader = ({
120120
[path]: {
121121
page: module.default,
122122
state: 'DONE',
123-
location: { ...location },
123+
location,
124124
},
125125
}))
126126
setRenderedChildren(children)
@@ -134,18 +134,11 @@ export const ActiveRouteLoader = ({
134134
clearLoadingTimeout()
135135
startPageLoadTransition(spec, delay)
136136
} else {
137-
// Handle navigating to the same page again, but with different path params
137+
// Handle navigating to the same page again, but with different path
138+
// params (i.e. new `location`)
138139
setLoadingState((loadingState) => {
139140
const page = loadingState[path]?.page || ArlNullPage
140-
141-
return {
142-
...loadingState,
143-
[path]: {
144-
page,
145-
state: 'DONE',
146-
location: { ...location },
147-
},
148-
}
141+
return { ...loadingState, [path]: { page, state: 'DONE', location } }
149142
})
150143
}
151144

@@ -167,7 +160,7 @@ export const ActiveRouteLoader = ({
167160
[path]: {
168161
state: 'DONE',
169162
page: PageFromLoader,
170-
location: { ...location },
163+
location,
171164
},
172165
}
173166

0 commit comments

Comments
 (0)