Skip to content

Conversation

shrutikapoor08
Copy link
Contributor

@shrutikapoor08 shrutikapoor08 commented Sep 3, 2025

Incorporating feedback from PR - #4089. Changes made -

  1. Moved images to assets folder on suggestion
  2. Changed URLs from absolute to relative.
  3. Adding an in-line sequence diagram

Summary by CodeRabbit

  • Bug Fixes

    • Newly added jokes now receive unique identifiers, improving reliability when creating new entries.
  • Documentation

    • Updated links to internal paths for SSR, router concepts, and React Query sections.
    • Switched images to repository-hosted assets for consistency and availability.
    • Replaced the data flow image with an inline Mermaid sequence diagram covering home-page loading and add-joke flows, including data refresh behavior.
    • Minor formatting cleanup.

Copy link
Contributor

coderabbitai bot commented Sep 3, 2025

Walkthrough

Updated a React framework doc page by converting external links to relative paths, switching image assets to GitHub raw URLs, replacing a static data-flow image with a Mermaid sequence diagram, and revising a server action code snippet to generate UUIDs for new jokes. Minor formatting cleanup applied.

Changes

Cohort / File(s) Summary of changes
React docs: reading/writing file
docs/start/framework/react/reading-writing-file.md
- Converted external links (SSR, TanStack Router, React Query) to internal/relative paths
- Replaced image references with GitHub raw asset URLs
- Replaced Data Flow Diagram image with inline Mermaid sequenceDiagram (home loader and add-joke flows)
- Updated code snippet to use uuid v4 for joke IDs (import { v4 as uuidv4 } from 'uuid'; id: uuidv4())
- Removed an extra blank line in a snippet

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant R as Router (Client)
  participant L as Loader (Home)
  participant S as Server
  participant FS as jokes.json

  rect rgba(200,220,255,0.25)
  note over U,R: Home page navigation
  U->>R: Navigate to "/"
  R->>L: invoke loader()
  L->>S: GET jokes
  S->>FS: read jokes.json
  FS-->>S: jokes[]
  S-->>L: jokes[]
  L-->>R: loader data
  R-->>U: Render home with jokes
  end

  rect rgba(220,255,220,0.25)
  note over U,R: Add joke flow
  U->>R: Submit "Add Joke"
  R->>S: server action addJoke(payload)
  S->>S: create { id: uuidv4(), ... }
  S->>FS: write jokes.json
  S-->>R: success
  R->>R: router.invalidate() / refetch
  R->>L: re-invoke loader()
  L->>S: GET jokes (updated)
  S->>FS: read jokes.json
  FS-->>S: jokes[] (with new joke)
  S-->>L: jokes[]
  L-->>R: loader data
  R-->>U: Updated list rendered
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I nibbled links from far to near,
Drew flows with fins of Mermaid clear,
A UUID for every joke—no twins! hooray!
The router hops, invalidates its way,
Screens refresh like fields in spring—
Docs now hum, and carrots sing. 🥕✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch skapoor-devjokes-tutorial-2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the documentation Everything documentation related label Sep 3, 2025
Copy link

nx-cloud bot commented Sep 3, 2025

View your CI Pipeline Execution ↗ for commit c4ff80a

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded <1s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2025-09-03 02:58:47 UTC

Copy link

pkg-pr-new bot commented Sep 3, 2025

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5072

@tanstack/directive-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5072

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5072

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5072

@tanstack/react-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5072

@tanstack/react-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5072

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5072

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5072

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5072

@tanstack/react-start-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-plugin@5072

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5072

@tanstack/router-cli

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5072

@tanstack/router-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5072

@tanstack/router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5072

@tanstack/router-devtools-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5072

@tanstack/router-generator

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5072

@tanstack/router-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5072

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5072

@tanstack/router-utils

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5072

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5072

@tanstack/server-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5072

@tanstack/solid-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5072

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5072

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5072

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5072

@tanstack/solid-start-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-plugin@5072

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5072

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5072

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5072

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5072

@tanstack/start-server-functions-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-functions-client@5072

@tanstack/start-server-functions-fetcher

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-functions-fetcher@5072

@tanstack/start-server-functions-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-functions-server@5072

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5072

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5072

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5072

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5072

commit: c4ff80a

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/start/framework/react/reading-writing-file.md (1)

413-441: Form submit handler doesn’t prevent default; submitting will navigate/reload.

onSubmit calls a handler that doesn’t receive the event or call preventDefault, which will break the demo flow.

Apply:

-  const handleSubmit = async () => {
+  const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {
+    e.preventDefault()
     if (!question || !answer || isSubmitting) return
     try {
       setIsSubmitting(true)
       await addJoke({
         data: { question, answer },
       })

And add the missing type import (outside this hunk):

-import { useState } from 'react'
+import { useState, type FormEvent } from 'react'
🧹 Nitpick comments (1)
docs/start/framework/react/reading-writing-file.md (1)

474-504: Mermaid diagram reads well; align the call label with the actual function signature and confirm Mermaid rendering is enabled.

  • In code, addJoke is called with an object { data: { question, answer } }. Update the diagram label for accuracy.
  • Please confirm the docs site has Mermaid enabled for code fences.
-UI ->> Server: handleSubmit → addJoke(newJoke)
+UI ->> Server: handleSubmit → addJoke({ data })
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3178314 and c4ff80a.

⛔ Files ignored due to path filters (3)
  • docs/router/assets/reading-writing-file-devjokes-1.png is excluded by !**/*.png
  • docs/router/assets/reading-writing-file-devjokes-2.png is excluded by !**/*.png
  • docs/router/assets/reading-writing-file-setup.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • docs/start/framework/react/reading-writing-file.md (5 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/start/framework/react/reading-writing-file.md

[grammar] ~29-~29: There might be a mistake here.
Context: ... to know - Server Side Rendering (SSR) - [TanStack Router concepts](/router/latest...

(QB_NEW_EN)


[grammar] ~30-~30: There might be a mistake here.
Context: ...t/guide/ssr) - TanStack Router concepts - [React Query concepts](/query/latest/docs...

(QB_NEW_EN)

🔇 Additional comments (2)
docs/start/framework/react/reading-writing-file.md (2)

29-31: Good switch to site-relative links; confirm paths resolve under the docs build.

The root-relative URLs look right and avoid hard-coding the domain. Please just verify these resolve correctly in the deployed docs site navigation.


249-249: I’ve initiated a repository search to verify the presence and correct path of the asset.

@@ -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 -

![TanStack Start Welcome Page After Setup](https://res.cloudinary.com/dubc3wnbv/image/upload/v1746312482/Photo-1_lpechn.png)
![TanStack Start Welcome Page After Setup](https://raw.githubusercontent.com/TanStack/router/main/docs/router/assets/reading-writing-file-setup.png)
Copy link
Contributor

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:

-![TanStack Start Welcome Page After Setup](https://raw.githubusercontent.com/TanStack/router/main/docs/router/assets/reading-writing-file-setup.png)
+![TanStack Start Welcome Page After Setup](/router/assets/reading-writing-file-setup.png)

🏁 Script executed:

#!/bin/bash
find . -type f -name 'reading-writing-file-setup.png'
grep -R "/router/assets" -n docs

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:

-![TanStack Start Welcome Page After Setup](https://raw.githubusercontent.com/TanStack/router/main/docs/router/assets/reading-writing-file-setup.png)
+![TanStack Start Welcome Page After Setup](/router/assets/reading-writing-file-setup.png)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
![TanStack Start Welcome Page After Setup](https://raw.githubusercontent.com/TanStack/router/main/docs/router/assets/reading-writing-file-setup.png)
![TanStack Start Welcome Page After Setup](/router/assets/reading-writing-file-setup.png)
🤖 Prompt for AI Agents
In docs/start/framework/react/reading-writing-file.md around line 99, the image
uses a raw.githubusercontent.com absolute URL; replace it with a
repo-local/site-relative asset path (e.g., point to the image file under the
docs assets directory such as /docs/router/assets/reading-writing-file-setup.png
or the correct relative path from this markdown file) so the site builds and
serves the image from the repo instead of relying on raw.githubusercontent.com.

@@ -445,7 +444,7 @@
```

With this, our UI should look like this:
![DevJoke App with Form to Add Jokes](https://res.cloudinary.com/dubc3wnbv/image/upload/v1746356983/Screenshot_2025-05-04_at_4.06.57_AM_dkgvsm.png)
![DevJoke App with Form to Add Jokes](https://raw.githubusercontent.com/TanStack/router/main/docs/router/assets/reading-writing-file-devjokes-2.jpg)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Same: switch image to a site-relative asset URL.

-![DevJoke App with Form to Add Jokes](https://raw.githubusercontent.com/TanStack/router/main/docs/router/assets/reading-writing-file-devjokes-2.jpg)
+![DevJoke App with Form to Add Jokes](/router/assets/reading-writing-file-devjokes-2.jpg)

🏁 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"
fi

Length of output: 96


Add missing image asset or correct its path (docs/start/framework/react/reading-writing-file.md:447)
The file docs/router/assets/reading-writing-file-devjokes-2.jpg isn’t present; add it there (or update the URL to the correct existing location) before switching the Markdown to a site-relative path.

🤖 Prompt for AI Agents
In docs/start/framework/react/reading-writing-file.md around line 447, the
referenced image path docs/router/assets/reading-writing-file-devjokes-2.jpg is
missing; either add the image file at that exact path in the repository or
update the Markdown to point to the correct existing asset path (or a remote
URL). After placing the image or correcting the path, verify the link works
locally and then convert the Markdown image reference to a site-relative path if
required.

@brenelz
Copy link
Contributor

brenelz commented Sep 5, 2025

Waiting on this Tanstack.com pr before merge
TanStack/tanstack.com#481

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Everything documentation related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants