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" ;
22
33export default function Index ( ) {
4- return < Link href = "/test" > index</ Link > ;
4+ return < Link href = "/test?test " > index</ Link > ;
55}
Original file line number Diff line number Diff line change 11import { Suspense } from "react" ;
22import { hydrateRoot } from "react-dom/client" ;
33import { RouterHost } from "./router" ;
4- import { ServerSideProps } from "./types" ;
54import { getRouteMatcher } from "./router/utils/get-route-matcher" ;
5+ import { ServerSideProps } from "./types" ;
66
77const globalX = globalThis as unknown as {
88 __PAGES_DIR__ : string ;
@@ -16,7 +16,7 @@ const match = getRouteMatcher(globalX.__ROUTES__);
1616export async function hydrate (
1717 Shell : React . ComponentType < { children : React . ReactElement } & ServerSideProps >
1818) {
19- const matched = match ( globalX . __INITIAL_ROUTE__ ) ! ;
19+ const matched = match ( globalX . __INITIAL_ROUTE__ . split ( "?" ) [ 0 ] ) ! ;
2020 const Initial = await import ( matched . value ) ;
2121 return hydrateRoot (
2222 document ,
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ export class StaticRouters {
4747 bootstrapModules ?: string [ ] ;
4848 }
4949 ) {
50- const { pathname } = new URL ( request . url ) ;
50+ const { pathname, search } = new URL ( request . url ) ;
5151 const staticResponse = await serveFromDir ( {
5252 directory : this . buildDir ,
5353 path : pathname ,
@@ -92,7 +92,7 @@ export class StaticRouters {
9292 bootstrapScriptContent : [
9393 preloadScript ,
9494 `__PAGES_DIR__=${ JSON . stringify ( this . pageDir ) } ` ,
95- `__INITIAL_ROUTE__=${ JSON . stringify ( serverSide . pathname ) } ` ,
95+ `__INITIAL_ROUTE__=${ JSON . stringify ( serverSide . pathname + search ) } ` ,
9696 `__ROUTES__=${ this . #routes_dump} ` ,
9797 `__SERVERSIDE_PROPS__=${ stringified } ` ,
9898 ]
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ export const RouterHost = ({
4848 Shell : React . ComponentType < { children : React . ReactElement } > ;
4949} ) => {
5050 const pathname = useLocationProperty (
51- ( ) => location . pathname ,
51+ ( ) => location . pathname + location . search ,
5252 ( ) => globalX . __INITIAL_ROUTE__
5353 ) ;
5454 const [ current , setCurrent ] = useState ( children ) ;
@@ -58,7 +58,7 @@ export const RouterHost = ({
5858 ( async ( ) => {
5959 const currentVersion = ++ version . current ;
6060 const [ module , props ] = await Promise . all ( [
61- import ( match ( pathname ) ! . value ) ,
61+ import ( match ( pathname . split ( "?" ) [ 0 ] ) ! . value ) ,
6262 cachedFetchServerSideProps ( pathname ) ,
6363 ] ) ;
6464 if ( currentVersion === version . current ) {
You can’t perform that action at this time.
0 commit comments