Skip to content

Commit 9f45788

Browse files
Feat/console pipe (#337)
* feat: console piping * implement the two way pipping * ci: apply automated fixes * revert: remove console piping from devtools-vite * revert client changes * ci: apply automated fixes * remove extra file * fix for logs * fix23 * improvements * knip issues * ci: apply automated fixes * changeeset * changeset --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent bb40bf4 commit 9f45788

File tree

18 files changed

+807
-27
lines changed

18 files changed

+807
-27
lines changed

.changeset/breezy-schools-fail.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tanstack/devtools-vite': minor
3+
---
4+
5+
Console piping functionality

.changeset/shaggy-taxes-turn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tanstack/devtools': patch
3+
---
4+
5+
Fix a UI bug

examples/react/start/src/components/Header.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ import {
1111
StickyNote,
1212
X,
1313
} from 'lucide-react'
14+
import { createServerFn } from '@tanstack/react-start'
15+
16+
const logger = createServerFn({ method: 'POST' }).handler(async ({ data }) => {
17+
console.log('triggered logger server function')
18+
console.log(data)
19+
})
1420

1521
export default function Header() {
1622
const [isOpen, setIsOpen] = useState(false)
@@ -22,7 +28,11 @@ export default function Header() {
2228
<>
2329
<header className="p-4 flex items-center bg-gray-800 text-white shadow-lg">
2430
<button
25-
onClick={() => setIsOpen(true)}
31+
onClick={() => {
32+
console.log('Opening menu')
33+
logger()
34+
setIsOpen(true)
35+
}}
2636
className="p-2 hover:bg-gray-700 rounded-lg transition-colors"
2737
aria-label="Open menu"
2838
>

examples/react/start/src/routes/demo/start.api-request.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ function getNames() {
99

1010
export const Route = createFileRoute('/demo/start/api-request')({
1111
component: Home,
12+
beforeLoad: () => {
13+
console.log('Before loading Start API Request Demo route')
14+
},
1215
loader: () => {
16+
console.log('Navigated to Start API Request Demo')
1317
emitRouteNavigation('API Request', '/demo/start/api-request')
1418
},
1519
})

examples/react/start/src/routes/demo/start.server-funcs.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
import fs from 'node:fs'
22
import { useCallback, useState } from 'react'
33
import { createFileRoute, useRouter } from '@tanstack/react-router'
4-
import { createServerFn } from '@tanstack/react-start'
4+
import { createMiddleware, createServerFn } from '@tanstack/react-start'
55
import { emitRouteNavigation } from '../../devtools'
66

7-
/*
87
const loggingMiddleware = createMiddleware().server(
98
async ({ next, request }) => {
10-
console.log("Request:", request.url);
11-
return next();
12-
}
13-
);
14-
const loggedServerFunction = createServerFn({ method: "GET" }).middleware([
9+
console.log('Request:', request.url)
10+
return next()
11+
},
12+
)
13+
const loggedServerFunction = createServerFn({ method: 'GET' }).middleware([
1514
loggingMiddleware,
16-
]);
17-
*/
15+
])
1816

1917
const TODOS_FILE = 'todos.json'
2018

examples/react/start/src/routes/demo/start.ssr.data-only.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export const Route = createFileRoute('/demo/start/ssr/data-only')({
66
ssr: 'data-only',
77
component: RouteComponent,
88
loader: async () => {
9+
console.log('Navigated to Data Only SSR Demo')
910
emitRouteNavigation('Data Only SSR', '/demo/start/ssr/data-only')
1011
return await getPunkSongs()
1112
},

examples/react/start/src/routes/demo/start.ssr.full-ssr.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { emitRouteNavigation } from '../../devtools'
55
export const Route = createFileRoute('/demo/start/ssr/full-ssr')({
66
component: RouteComponent,
77
loader: async () => {
8+
console.log('Navigated to Full SSR Demo')
89
emitRouteNavigation('Full SSR', '/demo/start/ssr/full-ssr')
910
return await getPunkSongs()
1011
},

examples/react/start/vite.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import { nitro } from 'nitro/vite'
88

99
const config = defineConfig({
1010
plugins: [
11-
devtools(),
11+
devtools({
12+
consolePiping: {},
13+
}),
1214
nitro(),
1315
// this is the plugin that enables path aliases
1416
viteTsConfigPaths({

examples/solid/basic/src/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import Router, { router } from './setup'
1313
const queryClient = new QueryClient()
1414

1515
function App() {
16+
console.log('Rendering App Component')
1617
return (
1718
<QueryClientProvider client={queryClient}>
1819
<h1>TanStack Devtools Solid Basic Example</h1>

examples/solid/start/src/app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import './app.css'
44

55
export default function App() {
66
const [count, setCount] = createSignal(0)
7-
7+
console.log('App component rendered with count:', count())
88
return (
99
<main>
1010
<TanStackDevtools plugins={[]} />

0 commit comments

Comments
 (0)