File tree Expand file tree Collapse file tree 4 files changed +10
-7
lines changed
Expand file tree Collapse file tree 4 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @solidjs/router " : patch
3+ ---
4+
5+ make url transform consistent
Original file line number Diff line number Diff line change @@ -13,8 +13,7 @@ export function Router(props: RouterProps): JSX.Element {
1313 const getSource = ( ) => {
1414 const url = window . location . pathname . replace ( / ^ \/ + / , "/" ) + window . location . search ;
1515 return {
16- value : props . transformUrl ? props . transformUrl ( url ) + window . location . hash : url + window . location . hash ,
17- rawPath : url ,
16+ value : url + window . location . hash ,
1817 state : window . history . state
1918 }
2019 } ;
Original file line number Diff line number Diff line change @@ -11,10 +11,8 @@ export type StaticRouterProps = BaseRouterProps & { url?: string };
1111
1212export function StaticRouter ( props : StaticRouterProps ) : JSX . Element {
1313 let e ;
14- const url = props . url || ( ( e = getRequestEvent ( ) ) && getPath ( e . request . url ) ) || ""
1514 const obj = {
16- value : props . transformUrl ? props . transformUrl ( url ) : url ,
17- rawPath : url ,
15+ value : props . url || ( ( e = getRequestEvent ( ) ) && getPath ( e . request . url ) ) || "" ,
1816 } ;
1917 return createRouterComponent ( {
2018 signal : [ ( ) => obj , next => Object . assign ( obj , next ) ]
Original file line number Diff line number Diff line change @@ -401,7 +401,7 @@ export function createRouterContext(
401401 return ;
402402 }
403403
404- const queryOnly = to [ 0 ] === "?" ;
404+ const queryOnly = ! to || to [ 0 ] === "?" ;
405405 const {
406406 replace,
407407 resolve,
@@ -414,9 +414,10 @@ export function createRouterContext(
414414 ...options
415415 } ;
416416
417+ let s : string ;
417418 const resolvedTo = resolve
418419 ? route . resolvePath ( to )
419- : resolvePath ( ( queryOnly && source ( ) . rawPath ) || "" , to ) ;
420+ : resolvePath ( ( queryOnly && ( s = source ( ) . value ) && s . split ( "?" ) [ 0 ] ) || "" , to ) ;
420421
421422 if ( resolvedTo === undefined ) {
422423 throw new Error ( `Path '${ to } ' is not a routable path` ) ;
You can’t perform that action at this time.
0 commit comments