-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into nested-route-escaping
- Loading branch information
Showing
16 changed files
with
620 additions
and
170 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,8 @@ | ||
import { RouterProvider, createRouter } from "@tanstack/solid-router"; | ||
import { routeTree } from "./routeTree.gen"; | ||
import { router } from "./router"; | ||
import { RouterProvider } from "@tanstack/solid-router"; | ||
|
||
import "./app.css"; | ||
|
||
const router = createRouter({ | ||
defaultErrorComponent: (err) => <div>{err.error.stack}</div>, | ||
routeTree, | ||
defaultPreload: "intent", | ||
defaultStaleTime: 5000, | ||
scrollRestoration: true | ||
}); | ||
|
||
// Register things for typesafety | ||
declare module "@tanstack/solid-router" { | ||
interface Register { | ||
router: typeof router; | ||
} | ||
} | ||
|
||
export default function App() { | ||
return <RouterProvider router={router} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// @refresh reload | ||
import { mount, StartClient } from "@solidjs/start/client"; | ||
import { mount, StartClientTanstack } from "@solidjs/start/client"; | ||
|
||
mount(() => <StartClient />, document.getElementById("app")!); | ||
mount(() => <StartClientTanstack />, document.getElementById("app")!); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,40 @@ | ||
// @refresh reload | ||
import { createHandler, StartServer } from "@solidjs/start/server"; | ||
import { createHandler, FetchEvent, StartServer } from "@solidjs/start/server"; | ||
import { createMemoryHistory } from "@tanstack/solid-router"; | ||
import { router } from "./router"; | ||
|
||
export default createHandler(() => ( | ||
<StartServer | ||
document={({ assets, children, scripts }) => ( | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
{assets} | ||
</head> | ||
<body> | ||
<div id="app">{children}</div> | ||
{scripts} | ||
</body> | ||
</html> | ||
)} | ||
/> | ||
)); | ||
const routerLoad = async (event: FetchEvent) => { | ||
const url = new URL(event.request.url); | ||
const path = url.href.replace(url.origin, ""); | ||
|
||
router.update({ | ||
history: createMemoryHistory({ | ||
initialEntries: [path] | ||
}) | ||
}); | ||
|
||
await router.load(); | ||
}; | ||
|
||
export default createHandler( | ||
() => ( | ||
<StartServer | ||
document={({ assets, children, scripts }) => ( | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
{assets} | ||
</head> | ||
<body> | ||
<div id="app">{children}</div> | ||
{scripts} | ||
</body> | ||
</html> | ||
)} | ||
/> | ||
), | ||
undefined, | ||
routerLoad | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { createRouter as createTanstackSolidRouter } from "@tanstack/solid-router"; | ||
import { routeTree } from "./routeTree.gen"; | ||
|
||
export function createRouter() { | ||
const router = createTanstackSolidRouter({ | ||
defaultErrorComponent: err => <div>{err.error.stack}</div>, | ||
routeTree, | ||
defaultPreload: "intent", | ||
defaultStaleTime: 5000, | ||
scrollRestoration: true | ||
}); | ||
return router; | ||
} | ||
|
||
export const router = createRouter(); | ||
|
||
// Register things for typesafety | ||
declare module "@tanstack/solid-router" { | ||
interface Register { | ||
router: ReturnType<typeof createRouter>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// @refresh skip | ||
import "vinxi/client"; | ||
export { StartClient } from "./StartClient"; | ||
export { StartClient, StartClientTanstack } from "./StartClient"; | ||
export { mount } from "./mount"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters