Skip to content

Commit

Permalink
feat: sync start docs
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljcafonso authored and atilafassina committed May 15, 2024
1 parent 4807164 commit 8b0e0f5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/routes/solid-start/advanced/session.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ const getUsers = cache(async (id: string) => {
const user = await getUser();
if (!user) throw redirect("/login");
return store.getUsers(id, "*");
});
}, "users");

// page component
export default function Students() {
export default function Users() {
const users = createAsync(() => getUsers());
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ With this method, however, there are some caveats to be aware of:
If the data needs a refresh, the [`refetch`](/guides/fetching-data#refetch) function returned in the `createResource` can be used.
2. Before the route is rendered, the `load` function is called.
It does not share the same `context` as the route.
The context tree that is exposed to the `load` function is anything above the `Routes` component.
The context tree that is exposed to the `load` function is anything above the `Page` component.
3. On both the server and the client, the `load` function is called.
The resources can avoid refetching if they serialized their data in the server render.
The server-side render will only wait for the resources to fetch and serialize if the resource signals are accessed under a `Suspense` boundary.
Expand Down
20 changes: 11 additions & 9 deletions src/routes/solid-start/building-your-application/routing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This includes your pages and API routes.

SolidStart traverses your `routes` directory, collects all of the routes, and then makes them accessible using the [`<FileRoutes />`](/solid-start/reference/routing/file-routes).
This component will only include your UI routes, and not your API routes.
Rather than manually defining each `Route` inside a `Routes` component, `<FileRoutes />` will generate the routes for you based on the file system.
Rather than manually defining each `Route` inside a `Router` component, `<FileRoutes />` will generate the routes for you based on the file system.

Because `<FileRoutes />` returns a routing config object, you can use it with the router of your choice.
In this example we use [`solid-router`](/solid-router):
Expand Down Expand Up @@ -93,27 +93,29 @@ To avoid this, you can rename the `index.tsx` file to the name of the folder it

#### Escaping nested routes

When you have a path that is nested but wish for it to have a separate Layout, you can escape the nested route by using the `.` character.
When you have a path that is nested but wish for it to have a separate Layout, you can escape the nested route by applying a name between `( )`.
This will allow you to create a new route that is not nested under the previous route:

```jsx {6}
```jsx {5-6}
|-- routes/
|-- users/
|-- index.tsx
|-- projects.tsx
|-- users.[id].tsx
|-- users(details)/
|-- [id].tsx
```

Additionally, you can incorporate nested layouts of their own:

```tsx {5-7}
```tsx {2, 78}
|-- routes/
|-- users.tsx/
|-- users.tsx
|-- users(details).tsx
|-- users/
|-- index.tsx
|-- projects.tsx
|-- users.[id]/
|-- index.tsx
|-- settings.tsx
|-- users(details)/
|-- [id].tsx
```

### Dynamic routes
Expand Down

0 comments on commit 8b0e0f5

Please sign in to comment.