Skip to content

Commit

Permalink
fix: solid router's not found route definition (#56)
Browse files Browse the repository at this point in the history
`NotFound` page component should be a function and not rendered.

If the `NotFound` function is called but it uses any router features (like returning a `<Navigate href="/" />`), the whole app will crash. `component` expects a function not a JSX expression.
  • Loading branch information
obedm503 authored Feb 25, 2023
1 parent 8f9eb92 commit 9b2714d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/generouted/src/solid-router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Fragment = (props: ParentProps) => <>{props.children}</>
const App = preservedRoutes?.['_app'] || Fragment
const NotFound = preservedRoutes?.['404'] || Fragment

export const routes = [...regularRoutes, { path: '*', component: <NotFound /> }] as RouteDefinition[]
export const routes = [...regularRoutes, { path: '*', component: NotFound }] as RouteDefinition[]

export const Routes = () => {
const Routes = useRoutes(routes)
Expand Down

0 comments on commit 9b2714d

Please sign in to comment.