Skip to content

Commit ce8ebe1

Browse files
committed
update docs
1 parent ee242eb commit ce8ebe1

17 files changed

+852
-416
lines changed

docs/content/01-started/01-installation.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,17 @@ export default defineConfig({
4747
Make sure your plugin is BEFORE the react router one!
4848
</WarningAlert>
4949

50+
51+
react-router-devtools uses @tanstack/devtools as the base for the UI, you can refer to their
52+
[documentation](https://tanstack.com/devtools/latest/docs/overview) for more information on how to use the devtools interface.
53+
5054
### CloudFlare
5155

5256
If you're trying to spin it up on CF, try adding this to your `optimizeDeps` in your `vite.config.js` file:
5357
```ts
5458
optimizeDeps: {
5559
include: [
5660
// other optimized deps
57-
"beautify",
58-
"react-diff-viewer-continued",
59-
"classnames",
6061
"@bkrem/react-transition-group",
6162
],
6263
},

docs/content/02-features/02-active-page-tab.mdx renamed to docs/content/02-features/01-active-page-tab.mdx

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ gradient background that can be set in the settings.
1616
<InfoAlert>
1717
This feature is only available in the development mode because it used react dev tools to find the `<Outlet />` component.
1818

19-
If you want to try it open up the dev tools right now nad hover over `/docs/main` in the panel.
20-
21-
You can also change the gradient background color in the settings.
2219
</InfoAlert>
2320

2421
## Loader list
@@ -33,16 +30,6 @@ the loader type and the loader file.
3330
- `green` - represents a normal route file, whether index or not
3431
</InfoAlert>
3532

36-
### Open in VS code
37-
38-
Each segment has an **open in VS code** button that opens the loader file in VS code.
39-
This is useful for quick navigation to the loader file.
40-
41-
<InfoAlert title="Caveat!">
42-
This only works if you have the `code` command installed in your terminal. If you don't have it installed you can
43-
install it by following the instructions [here](https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line).
44-
</InfoAlert>
45-
4633
### Loader data
4734

4835
Each segment has a loader data **JSON** object that contains all the information returned by the loader of that segment.
@@ -66,19 +53,6 @@ This will contain all the **wildcard** params currently available on this route.
6653
If you open up the dev tools, you will be able to see that `tag` and `slug` are both in
6754
the route params.
6855

69-
### Server info
70-
71-
The server info section contains all the server information for the current segment, including:
72-
- `loaderTriggerCount` - the number of times the loader has been triggered (updates in real-time)
73-
- `actionTriggerCount` - the number of times the action has been triggered (updates in real-time)
74-
- `lowestExecutionTime` - the lowest execution time of the loader (updates in real-time)
75-
- `highestExecutionTime` - the highest execution time of the loader (updates in real-time)
76-
- `averageExecutionTime` - the average execution time of the loader (updates in real-time)
77-
- `lastLoaderInfo` - the last loader info object (updates in real-time), includes execution time, request headers and response headers.
78-
- `lastActionInfo` - the last action info object (updates in real-time), includes execution time, request headers and response headers.
79-
- `loaderCalls` - an array of loaderInfo objects ordered from most recent to least recent (updates in real-time)
80-
- `actionCalls` - an array of actionInfo objects ordered from most recent to least recent (updates in real-time)
81-
8256
### handles
8357

8458
The handles section contains all the handles for the current segment.
@@ -98,7 +72,7 @@ The timeline section on the right contains useful information on navigation and
9872

9973
Every time there is a navigation or submission event, a new entry will be added to the timeline on the top.
10074

101-
It is limited to 50 entries and will remove the oldest entry when the limit is reached.
75+
It is limited to 30 entries and will remove the oldest entry when the limit is reached.
10276

10377
The timeline will contain the following information for each event:
10478
- `type` - the type of event (navigation or submission, fetcher or normal)

docs/content/02-features/01-shortcuts.mdx

Lines changed: 0 additions & 28 deletions
This file was deleted.
File renamed without changes.
Lines changed: 25 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ summary: "The Devtools context provides tracing utilities for loaders and action
44
description: "Using the devtools context to trace events and send them to the network tab"
55
---
66

7+
## TanStack DevTools Integration
8+
9+
React Router Devtools v6+ integrates with [TanStack DevTools](https://tanstack.com/devtools), providing enhanced debugging capabilities alongside React Router specific features. The devtools now include:
10+
11+
- React Router specific tabs (Active Page, Routes, Network, Timeline, Settings)
12+
- TanStack DevTools panels for advanced state inspection
13+
- Unified debugging experience with seamless integration
14+
15+
You can configure TanStack-specific behavior through the [general configuration](/configuration/general#tanstack-devtools-integration).
16+
17+
---
718

819
## Devtools extended context
920

@@ -19,9 +30,9 @@ export const loader = async ({ request, devTools }: LoaderFunctionArgs) => {
1930
const tracing = devTools?.tracing;
2031
// tracing is a set of utilities to be used in your data fetching functions to trace events
2132
// in network tab of react-router-devtools
22-
const startTime = tracing.start("my-event")
33+
const end = tracing.start("my-event")
2334
// do something here, eg DB call
24-
tracing.end("my-event", startTime!)
35+
end()
2536
return "data"
2637
}
2738
```
@@ -33,9 +44,9 @@ export const action = async ({ request, devTools }: ActionFunctionArgs) => {
3344
const tracing = devTools?.tracing;
3445
// tracing is a set of utilities to be used in your data fetching functions to trace events
3546
// in network tab of react-router-devtools
36-
const startTime = tracing?.start("my-event")
47+
const end = tracing?.start("my-event")
3748
// do something
38-
tracing?.end("my-event", startTime!)
49+
end()
3950
return "data"
4051
}
4152
```
@@ -47,9 +58,9 @@ export const clientLoader = async ({ request, devTools }: ClientLoaderFunctionAr
4758
const tracing = devTools?.tracing;
4859
// tracing is a set of utilities to be used in your data fetching functions to trace events
4960
// in network tab of react-router-devtools
50-
const startTime = tracing?.start("my-event")
61+
const end = tracing?.start("my-event")
5162
// do something
52-
tracing?.end("my-event", startTime!)
63+
end()
5364
return "data"
5465
}
5566
```
@@ -59,9 +70,9 @@ export const clientAction = async ({ request, devTools }: ClientActionFunctionAr
5970
const tracing = devTools?.tracing;
6071
// tracing is a set of utilities to be used in your data fetching functions to trace events
6172
// in network tab of react-router-devtools
62-
const startTime = tracing?.start("my-event")
73+
const end = tracing?.start("my-event")
6374
// do something
64-
tracing?.end("my-event", startTime!)
75+
end()
6576
return "data"
6677
}
6778
```
@@ -103,10 +114,9 @@ const loader = async ({ request, devTools }: LoaderFunctionArgs) => {
103114
The tracing object contains all the utilities related to network tab tracing feature of react-router-devtools.
104115

105116

106-
There are three functions you can use:
117+
There are two functions you can use:
107118
- trace
108119
- start
109-
- end
110120

111121

112122

@@ -143,18 +153,18 @@ This is used together with `end` to trace the time of the event.
143153
export const loader = async ({ request, devTools }: LoaderFunctionArgs) => {
144154
const tracing = devTools?.tracing;
145155
// this will be traced in the network tab of react-router-devtools
146-
const startTime = tracing?.start("my-event")
156+
const end = tracing?.start("my-event")
147157
// do something here, eg DB call
148158

149159
// End the trace
150-
tracing?.end("my-event", startTime!)
160+
end()
151161
return "data"
152162
}
153163
```
154164

155165
<WarningAlert title="Warning">
156-
This function relies on you using the `end` with the same name as the start event, otherwise
157-
you will end up having a never ending loading bar in the network tab!
166+
This function relies on you using the `end`returned from it, otherwise the event
167+
will never end in your devtools
158168
</WarningAlert>
159169

160170

@@ -164,32 +174,4 @@ you will end up having a never ending loading bar in the network tab!
164174

165175
#### Returns
166176

167-
The start time of the event
168-
169-
### end
170-
171-
The `end` function is a function that will end a trace for the name provided to it and return the end time.
172-
173-
```ts
174-
export const loader = async ({ request, devTools }: LoaderFunctionArgs) => {
175-
const tracing = devTools?.tracing;
176-
// this will be traced in the network tab of react-router-devtools
177-
const startTime = tracing?.start("get user")
178-
// do something here, eg DB call
179-
const user = await getUser();
180-
// End the trace
181-
tracing?.end("get user", startTime!, { user })
182-
return "data"
183-
184-
}
185-
```
186-
187-
#### Parameters
188-
189-
- `name` - The name of the event
190-
- `startTime` - The start time of the sendEvent
191-
- `data` - The data to be sent with the event
192-
193-
#### Returns
194-
195-
The data provided in the last parameter
177+
The end trace function

docs/content/02-features/04-errors-tab.mdx

Lines changed: 0 additions & 39 deletions
This file was deleted.

docs/content/02-features/08-network-tab.mdx renamed to docs/content/02-features/04-network-tab.mdx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,32 @@ To shuffle through the requests, press the `←` and `→` keys.
1313

1414
## Request types
1515

16-
There are four types of requests in react-router-devtools:
16+
There are six types of data handling exports in react-router-devtools:
1717
- **client-loader** - A client-loader is a request that is initiated by the client and is used to load data for a route.
1818
- **client-action** - A client-action is a request that is initiated by the client and is used to submit data to a route.
1919
- **loader** - A loader is a request that is initiated by the server and is used to load data for a route.
2020
- **action** - An action is a request that is initiated by the server and is used to submit data to a route.
21+
- **middleware** - A middleware is run before and after all your loaders on the server
22+
- **client-middleware** - A client-middleware is run before and after all your client-loaders on the client
2123

2224
<InfoAlert>
2325
Each of these is colored differently for you to be able to quickly identify them.
2426
- loader - green
2527
- client-loader - blue
2628
- action - purple
2729
- client-action - yellow
30+
- middleware - orange
31+
- client-middleware - pink
2832
- aborted requests - red
33+
2934
</InfoAlert>
3035

36+
37+
## Filtering
38+
39+
You can filter the requests by their type by clicking on the filter buttons at the top of the network tab.
40+
You can also filter by route as well
41+
3142
## Request info
3243

3344
Clicking on any request name will show you detailed information about that request. This includes the request's name, the

docs/content/02-features/05-settings-tab.mdx

Lines changed: 0 additions & 21 deletions
This file was deleted.

docs/content/02-features/06-detach.mdx

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)