File tree Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 1
- import { Link , navigate , useLink } from "bun-react-ssr/router" ;
1
+ import { Link } from "bun-react-ssr/router" ;
2
2
3
3
export default function Index ( ) {
4
- return < Link href = "/test" > index</ Link > ;
4
+ return < Link href = "/test?test " > index</ Link > ;
5
5
}
Original file line number Diff line number Diff line change 1
1
import { Suspense } from "react" ;
2
2
import { hydrateRoot } from "react-dom/client" ;
3
3
import { RouterHost } from "./router" ;
4
- import { ServerSideProps } from "./types" ;
5
4
import { getRouteMatcher } from "./router/utils/get-route-matcher" ;
5
+ import { ServerSideProps } from "./types" ;
6
6
7
7
const globalX = globalThis as unknown as {
8
8
__PAGES_DIR__ : string ;
@@ -16,7 +16,7 @@ const match = getRouteMatcher(globalX.__ROUTES__);
16
16
export async function hydrate (
17
17
Shell : React . ComponentType < { children : React . ReactElement } & ServerSideProps >
18
18
) {
19
- const matched = match ( globalX . __INITIAL_ROUTE__ ) ! ;
19
+ const matched = match ( globalX . __INITIAL_ROUTE__ . split ( "?" ) [ 0 ] ) ! ;
20
20
const Initial = await import ( matched . value ) ;
21
21
return hydrateRoot (
22
22
document ,
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ export class StaticRouters {
47
47
bootstrapModules ?: string [ ] ;
48
48
}
49
49
) {
50
- const { pathname } = new URL ( request . url ) ;
50
+ const { pathname, search } = new URL ( request . url ) ;
51
51
const staticResponse = await serveFromDir ( {
52
52
directory : this . buildDir ,
53
53
path : pathname ,
@@ -92,7 +92,7 @@ export class StaticRouters {
92
92
bootstrapScriptContent : [
93
93
preloadScript ,
94
94
`__PAGES_DIR__=${ JSON . stringify ( this . pageDir ) } ` ,
95
- `__INITIAL_ROUTE__=${ JSON . stringify ( serverSide . pathname ) } ` ,
95
+ `__INITIAL_ROUTE__=${ JSON . stringify ( serverSide . pathname + search ) } ` ,
96
96
`__ROUTES__=${ this . #routes_dump} ` ,
97
97
`__SERVERSIDE_PROPS__=${ stringified } ` ,
98
98
]
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ export const RouterHost = ({
48
48
Shell : React . ComponentType < { children : React . ReactElement } > ;
49
49
} ) => {
50
50
const pathname = useLocationProperty (
51
- ( ) => location . pathname ,
51
+ ( ) => location . pathname + location . search ,
52
52
( ) => globalX . __INITIAL_ROUTE__
53
53
) ;
54
54
const [ current , setCurrent ] = useState ( children ) ;
@@ -58,7 +58,7 @@ export const RouterHost = ({
58
58
( async ( ) => {
59
59
const currentVersion = ++ version . current ;
60
60
const [ module , props ] = await Promise . all ( [
61
- import ( match ( pathname ) ! . value ) ,
61
+ import ( match ( pathname . split ( "?" ) [ 0 ] ) ! . value ) ,
62
62
cachedFetchServerSideProps ( pathname ) ,
63
63
] ) ;
64
64
if ( currentVersion === version . current ) {
You can’t perform that action at this time.
0 commit comments