-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Moving images inline and changing urls to relative #5072
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
Changes from all commits
b0e48e3
02c13a5
8cbcee5
c4ff80a
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 |
|---|---|---|
|
|
@@ -26,9 +26,9 @@ The complete code for this tutorial is available on [GitHub](https://github.com/ | |
|
|
||
| ## Nice to know | ||
|
|
||
| - [Server Side Rendering (SSR)](https://tanstack.com/router/latest/docs/framework/react/guide/ssr) | ||
| - [TanStack Router concepts](https://tanstack.com/router/latest/docs/framework/react/routing/routing-concepts) | ||
| - [React Query concepts](https://tanstack.com/query/latest/docs/framework/react/overview) | ||
| - [Server Side Rendering (SSR)](/router/latest/docs/framework/react/guide/ssr) | ||
| - [TanStack Router concepts](/router/latest/docs/framework/react/routing/routing-concepts) | ||
| - [React Query concepts](/query/latest/docs/framework/react/overview) | ||
|
|
||
| ## Setting up a TanStack Start Project | ||
|
|
||
|
|
@@ -96,7 +96,7 @@ Once your project is set up, you can access your app at `localhost:3000`. You sh | |
|
|
||
| At this point, your app will look like this - | ||
|
|
||
|  | ||
|  | ||
|
|
||
| ## Step 1: Reading Data From a File | ||
|
|
||
|
|
@@ -164,7 +164,6 @@ Let's create a new file `src/serverActions/jokesActions.ts` to create a server f | |
|
|
||
| ```tsx | ||
| // src/serverActions/jokesActions.ts | ||
|
|
||
| import { createServerFn } from '@tanstack/react-start' | ||
| import * as fs from 'node:fs' | ||
| import type { JokesData } from '../types' | ||
|
|
@@ -247,7 +246,7 @@ When the page loads, `jokes` will have data from the `jokes.json` file already! | |
|
|
||
| With a little Tailwind styling, the app should look like this: | ||
|
|
||
|  | ||
|  | ||
|
|
||
| ## Step 2: Writing Data to a File | ||
|
|
||
|
|
@@ -445,7 +444,7 @@ export function JokeForm() { | |
| ``` | ||
|
|
||
| With this, our UI should look like this: | ||
|  | ||
|  | ||
|
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. 💡 Verification agent 🧩 Analysis chainSame: switch image to a site-relative asset URL. -
+🏁 Script executed: #!/bin/bash
# Search for the asset file in the repository
rg -n "reading-writing-file-devjokes-2.jpg"Length of output: 247 🏁 Script executed: #!/bin/bash
# Verify the asset file exists in the expected directory
if [ -f docs/router/assets/reading-writing-file-devjokes-2.jpg ]; then
echo "exists: docs/router/assets/reading-writing-file-devjokes-2.jpg"
else
echo "not found"
fiLength of output: 96 Add missing image asset or correct its path (docs/start/framework/react/reading-writing-file.md:447) 🤖 Prompt for AI Agents |
||
|
|
||
| ## Understanding How It All Works Together | ||
|
|
||
|
|
@@ -472,7 +471,37 @@ Let's break down how the different parts of our application work together: | |
|
|
||
| ### Data Flow | ||
|
|
||
|  | ||
| ```mermaid | ||
| sequenceDiagram | ||
| autonumber | ||
| actor User | ||
| participant UI as Browser (HomePage + Form) | ||
| participant Loader as Route Loader (loader) | ||
| participant Server | ||
| participant Store as jokes.json | ||
|
|
||
| %% Visiting the Home Page | ||
| User ->> UI: Visit / | ||
| UI ->> Loader: loader() calls getJokes() | ||
| Loader ->> Server: getJokes() | ||
| Server ->> Store: Read jokes.json | ||
| Store -->> Server: jokes data | ||
| Server -->> Loader: jokes[] | ||
| Loader -->> UI: useLoaderData() → jokes[] | ||
|
|
||
| %% Adding a New Joke | ||
| User ->> UI: Fill form and submit | ||
| UI ->> Server: handleSubmit → addJoke(newJoke) | ||
| Server ->> Store: Read jokes.json | ||
| Server ->> Store: Write updated jokes.json | ||
| Server -->> UI: addJoke() resolved | ||
| UI ->> Loader: router.invalidate() (re-run loader) | ||
| Loader ->> Server: getJokes() | ||
| Server ->> Store: Read jokes.json | ||
| Store -->> Server: updated jokes[] | ||
| Server -->> Loader: updated jokes[] | ||
| Loader -->> UI: useLoaderData() → updated jokes[] | ||
| ``` | ||
|
|
||
| When a user visits the home page: | ||
|
|
||
|
|
||
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.
💡 Verification agent
🧩 Analysis chain
Use repo-local asset paths instead of raw.githubusercontent.com.
Using raw GitHub bypasses any docs-site CDN/optimizations and can break with CSP. Since assets live in the repo, prefer a site-relative path.
Apply:
🏁 Script executed:
Length of output: 1035
Use repo-local asset paths instead of raw.githubusercontent.com.
Replace the image URL at line 99 with a site-relative path:
📝 Committable suggestion
🤖 Prompt for AI Agents