-
Notifications
You must be signed in to change notification settings - Fork 425
Docs/update tanstack guide #1266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
7d6266c
d164f6b
ef5dd92
7c2dece
a5a973d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "uploadthing": patch | ||
| --- | ||
|
|
||
| Updated TanStack Start documentation and example to version 1.158.0 |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,6 +23,8 @@ This repository contains the packages, docs and examples for uploadthing | |||||||||
| A simple example using the Next.js pages directory | ||||||||||
| - [SolidStart SSR](https://github.com/pingdotgg/uploadthing/tree/main/examples/minimal-solidstart) - | ||||||||||
| A simple example using SSR with SolidStart | ||||||||||
| - [Tanstack Start](https://github.com/TokiLoshi/uploadthing/tree/main/examples/minimal-tanstack-start) - | ||||||||||
| A simple example using Tanstack start | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Point the TanStack Start link at the canonical repo and fix casing. The URL currently points to a user fork; aligning with the other entries, it should target the main ✏️ Suggested fix-- [Tanstack Start](https://github.com/TokiLoshi/uploadthing/tree/main/examples/minimal-tanstack-start) -
- A simple example using Tanstack start
+- [TanStack Start](https://github.com/pingdotgg/uploadthing/tree/main/examples/minimal-tanstack-start) -
+ A simple example using TanStack Start📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| - [Docs Site](https://github.com/pingdotgg/uploadthing/tree/main/docs) - Source | ||||||||||
| for docs.uploadthing.com | ||||||||||
| - [React Package](https://github.com/pingdotgg/uploadthing/tree/main/packages/react) - | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,12 @@ | ||
| import { createRouter as createTanStackRouter } from "@tanstack/react-router"; | ||
| import { createRouter } from "@tanstack/react-router"; | ||
|
|
||
| import { routeTree } from "./routeTree.gen"; | ||
|
|
||
| export function createRouter() { | ||
| const router = createTanStackRouter({ | ||
| export function getRouter() { | ||
| const router = createRouter({ | ||
| routeTree, | ||
| scrollRestoration: true, | ||
| }); | ||
|
|
||
| return router; | ||
| } | ||
|
|
||
| declare module "@tanstack/react-router" { | ||
| interface Register { | ||
| router: ReturnType<typeof createRouter>; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,47 @@ | ||
| import * as React from "react"; | ||
| import * as TSR from "@tanstack/react-router"; | ||
| /// <reference types="vite/client" /> | ||
| import type { ReactNode } from "react"; | ||
| import { | ||
| createRootRoute, | ||
| HeadContent, | ||
| Outlet, | ||
| Scripts, | ||
| } from "@tanstack/react-router"; | ||
|
|
||
| import uploadthingCss from "@uploadthing/react/styles.css?url"; | ||
|
|
||
| export const Route = TSR.createRootRoute({ | ||
| component: RootComponent, | ||
| export const Route = createRootRoute({ | ||
| head: () => ({ | ||
| links: [{ rel: "stylesheet", href: uploadthingCss }], | ||
| meta: [ | ||
| { | ||
| charSet: "utf-8", | ||
| }, | ||
| { | ||
| name: "viewport", | ||
| content: "width=device-width, initial-scale=1", | ||
| }, | ||
| { | ||
| title: "TanStack Start Starter", | ||
| }, | ||
| ], | ||
| }), | ||
|
Comment on lines
13
to
27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. UploadThing CSS styles are missing. The documentation shows CSS should be imported for proper component styling, but the import was removed from this file and not replaced anywhere else. The old code had: import uploadthingCss from "@uploadthing/react/styles.css?url";
export const Route = createRootRoute({
head: () => ({
links: [{ rel: "stylesheet", href: uploadthingCss }],
}),
});According to the documentation at import uploadthingCss from "@uploadthing/react/styles.css?url";
export const Route = createRootRoute({
head: () => ({
meta: [
{
charSet: "utf-8",
},
{
name: "viewport",
content: "width=device-width, initial-scale=1",
},
{
title: "TanStack Start Starter",
},
],
links: [{ rel: "stylesheet", href: uploadthingCss }],
}),
component: RootComponent,
});Prompt To Fix With AIThis is a comment left during a code review.
Path: examples/minimal-tanstack-start/src/routes/__root.tsx
Line: 11:24
Comment:
UploadThing CSS styles are missing. The documentation shows CSS should be imported for proper component styling, but the import was removed from this file and not replaced anywhere else.
The old code had:
```typescript
import uploadthingCss from "@uploadthing/react/styles.css?url";
export const Route = createRootRoute({
head: () => ({
links: [{ rel: "stylesheet", href: uploadthingCss }],
}),
});
```
According to the documentation at `docs/src/app/(docs)/getting-started/tanstack-start/page.mdx`, you should add:
```typescript
import uploadthingCss from "@uploadthing/react/styles.css?url";
export const Route = createRootRoute({
head: () => ({
meta: [
{
charSet: "utf-8",
},
{
name: "viewport",
content: "width=device-width, initial-scale=1",
},
{
title: "TanStack Start Starter",
},
],
links: [{ rel: "stylesheet", href: uploadthingCss }],
}),
component: RootComponent,
});
```
How can I resolve this? If you propose a fix, please make it concise. |
||
| component: RootComponent, | ||
| }); | ||
|
|
||
| function RootComponent() { | ||
| return ( | ||
| <RootDocument> | ||
| <TSR.Outlet /> | ||
| <Outlet /> | ||
| </RootDocument> | ||
| ); | ||
| } | ||
|
|
||
| function RootDocument({ children }: { children: React.ReactNode }) { | ||
| function RootDocument({ children }: Readonly<{ children: ReactNode }>) { | ||
| return ( | ||
| <html> | ||
| <head> | ||
| <TSR.HeadContent /> | ||
| <HeadContent /> | ||
| </head> | ||
| <body> | ||
| {children} | ||
| <TSR.Scripts /> | ||
| <Scripts /> | ||
| </body> | ||
| </html> | ||
| ); | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { createFileRoute } from "@tanstack/react-router"; | ||
|
|
||
| import { createRouteHandler } from "uploadthing/server"; | ||
|
|
||
| import { uploadRouter } from "../../server/uploadthing"; | ||
|
|
||
| const handler = createRouteHandler({ router: uploadRouter }); | ||
|
|
||
| export const Route = createFileRoute("/api/uploadthing")({ | ||
| server: { | ||
| handlers: { | ||
| GET: async ({ request }: { request: Request }) => { | ||
| return handler(request); | ||
| }, | ||
| POST: ({ request }: { request: Request }) => { | ||
| return handler(request); | ||
| }, | ||
| }, | ||
| }, | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,16 @@ | ||
| import { tanstackStart } from "@tanstack/react-start/plugin/vite"; | ||
| import viteReact from "@vitejs/plugin-react"; | ||
| import { defineConfig } from "vite"; | ||
| import tsConfigPaths from "vite-tsconfig-paths"; | ||
|
|
||
| export default defineConfig({ | ||
| server: { | ||
| port: 3000, | ||
| }, | ||
| plugins: [tanstackStart()], | ||
| plugins: [ | ||
| tsConfigPaths(), | ||
| tanstackStart(), | ||
| // react's vite plugin must come after start's vite plugin | ||
| viteReact(), | ||
| ], | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link points to
TokiLoshi/uploadthinginstead ofpingdotgg/uploadthingPrompt To Fix With AI