Skip to content

Commit 1b57656

Browse files
authored
Fix for wrapping wrong components (#168)
* Fix for wrapping wrong components * fix for docs
1 parent be6d265 commit 1b57656

File tree

10 files changed

+22
-16
lines changed

10 files changed

+22
-16
lines changed

docs/app/components/layout/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ export default function Header({
394394
<a
395395
className="group"
396396
aria-label="GitHub"
397-
href="https://github.com/Code-Forge-Net/react-router-devtools"
397+
href="https://github.com/forge42dev/react-router-devtools"
398398
target="_blank"
399399
rel="noreferrer"
400400
>

docs/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"rehype-slug": "^6.0.0",
5353
"remark-emoji": "^4.0.1",
5454
"remark-gfm": "^4.0.0",
55-
"remix-client-cache": "https://pkg.pr.new/forge42dev/[email protected]",
55+
"remix-client-cache": "2.0.0",
5656
"tailwind-merge": "^2.2.1",
5757
"unist-util-filter": "^5.0.1",
5858
"unist-util-visit": "^5.0.0",

docs/posts/main/guides/plugins.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { reactRouterDevTools } from "react-router-devtools";
1212
export default defineConfig({
1313
plugins: [
1414
reactRouterDevTools({
15-
pluginsDir: "./plugins"
15+
pluginDir: "./plugins"
1616
})],
1717
});
1818
```

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "react-router-devtools",
33
"description": "Devtools for React Router - debug, trace, find hydration errors, catch bugs and inspect server/client data with react-router-devtools",
44
"author": "Alem Tuzlak",
5-
"version": "1.0.4",
5+
"version": "1.0.5",
66
"license": "MIT",
77
"keywords": [
88
"react-router",

plugins/icon-library/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ This plugin allows you to see all your project icons in a new tab in react route
99
### Vite
1010
1. Create a plugin directory in your project. (eg on the root you can create a `your-path-here` folder)
1111
2. Copy the code from the plugin located in this folder. and paste it into there (eg `your-path-here/icon-library.tsx`)
12-
3. Specify the plugin directory in your vite config via the `pluginsDir` option:
12+
3. Specify the plugin directory in your vite config via the `pluginDir` option:
1313

1414
```js
1515
// vite.config.js
1616
export default {
17-
plugins: [reactRouterDevTools({ pluginsDir: './your-path-here' })]
17+
plugins: [reactRouterDevTools({ pluginDir: './your-path-here' })]
1818
}
1919
```
2020

plugins/tailwind-palette/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ This plugin allows you to see all tailwind colors in a new tab in react router d
1717
}
1818
```
1919
4. Copy the code from the plugin located in this folder. and paste it into there (eg `your-path-here/tailwind-palette.tsx`)
20-
5. Specify the plugin directory in your vite config via the `pluginsDir` option:
20+
5. Specify the plugin directory in your vite config via the `pluginDir` option:
2121

2222
```js
2323
// vite.config.js
2424
export default {
25-
plugins: [reactRouterDevTools({ pluginsDir: './your-path-here' })]
25+
plugins: [reactRouterDevTools({ pluginDir: './your-path-here' })]
2626
}
2727
```
2828

src/vite/plugin.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import type { RdtClientConfig } from "../client/context/RDTContext.js"
44
import { cutArrayToLastN } from "../client/utils/common.js"
55
import type { DevToolsServerConfig } from "../server/config.js"
66
import type { ActionEvent, LoaderEvent } from "../server/event-queue.js"
7-
87
import type { RequestEvent } from "../shared/request-event.js"
98
import { DEFAULT_EDITOR_CONFIG, type EditorConfig, type OpenSourceData, handleOpenSource } from "./editor.js"
109
import { type WriteFileData, handleWriteFile } from "./file.js"
@@ -55,17 +54,19 @@ export const reactRouterDevTools: (args?: ReactRouterViteConfig) => Plugin[] = (
5554
const includeDevtools = args?.includeInProd?.devTools ?? false
5655

5756
const appDir = args?.appDir || "./app"
58-
57+
const appDirName = appDir.replace("./", "")
5958
const shouldInject = (mode: string | undefined, include: boolean) => mode === "development" || include
6059
const isTransformable = (id: string) => {
6160
const extensions = [".tsx", ".jsx", ".ts", ".js"]
6261
if (!extensions.some((ext) => id.endsWith(ext))) {
6362
return
6463
}
65-
if (id.includes("node_modules") || id.includes("dist") || id.includes("build") || id.includes("?")) {
64+
const isRoute = id.includes(`${appDirName}/root`) || id.includes(`${appDirName}/routes`)
65+
if (id.includes("node_modules") || id.includes("dist") || id.includes("build") || id.includes("?") || !isRoute) {
6666
return
6767
}
68-
const routeId = id.replace(normalizePath(process.cwd()), "").replace("/app/", "").replace(".tsx", "")
68+
69+
const routeId = id.replace(normalizePath(process.cwd()), "").replace(`/${appDirName}/`, "").replace(".tsx", "")
6970
return routeId
7071
}
7172
// Set the server config on the process object so that it can be accessed by the plugin
@@ -240,7 +241,7 @@ export const reactRouterDevTools: (args?: ReactRouterViteConfig) => Plugin[] = (
240241
id.includes("?raw") ||
241242
id.includes("dist") ||
242243
id.includes("build") ||
243-
!id.includes("app")
244+
!id.includes(appDirName)
244245
)
245246
return
246247

test-apps/react-router-vite/app/routes/_index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import type { MetaFunction , LoaderFunctionArgs, ClientLoaderFunctionArgs} from "react-router";
33
import { Link, useFetcher, useSubmit } from "react-router";
44
import { Button } from "../components/Button";
5+
import * as ss from "~/utils/example";
56

67

78
export const meta: MetaFunction = () => {
@@ -12,8 +13,8 @@ export const meta: MetaFunction = () => {
1213
};
1314

1415

15-
export const loader = async ({ request, context,devTools }: LoaderFunctionArgs) => {
16-
16+
export const loader = async ({ request, context,devTools, params }: LoaderFunctionArgs) => {
17+
const d = await ss?.loader( );
1718
const trace = devTools?.tracing.trace
1819
const data = await trace?.("Loader call - GET users", async () => {
1920

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// new file - app/utils/example.ts
2+
export const loader = async () => {
3+
return { data: "example" };
4+
};

0 commit comments

Comments
 (0)