Skip to content
Source
Sign inSign up
fuko/trytanstackdb.com

Update the intro #28

Mergedfukomerged 9 commits intomain fromrefs/pull/28/headmerged by fuko View on GitHub

fukocommented
  • Refactor HomeIntro props to use intro instead of show_home_intro
  • Update the favicon
  • Update the social previews
  • Update the meta description
  • Update the intro text
  • Make the error title visible in light mode
  • Organize the imports
  • Make it easy to reset the db

Summary by CodeRabbit

  • New Features

    • Database reset action available directly from error screens
  • UI/UX Updates

    • Redesigned intro modal with Beta badge, backdrop blur, concise feature highlights, and a primary "Get started" button with updated icon
    • Updated author avatar styling, simplified copy, and streamlined link wording
    • Enhanced error messaging for database-query failures, including an in-place reset option and clearer visuals
✏️ Tip: You can customize this high-level summary in your review settings.
    1. Caution

      Review failed

      The pull request is closed.

      Walkthrough

      Refactored HomeIntro UI and modal styling, added a new exported idbName in DB module, introduced an IndexedDB reset flow (RemoveDB) wired into the root ErrorComponent for database-query failures, and renamed the HomeIntro prop from show_home_intro to intro.

      Changes

      Cohort / File(s)Summary
      HomeIntro UI & Modal
      src/components/HomeIntro.tsx
      Replaced inline layout with internal helpers (Bold, FeatureItem, WavyLine), migrated to CardHeader/CardContent structure, updated modal backdrop blur, badge text/color changes, simplified copy, changed primary action to "Get started", and added avatar border.
      Route prop usage
      src/routes/_tutorial.tsx
      Updated HomeIntro prop name from show_home_intro={intro} to intro={intro} (prop rename usage only).
      IndexedDB export
      src/db/index.ts
      Added new public export idbName = \/pglite/${dbName.replace("idb://", "")}`` with JSDoc; no runtime behavior change.
      Error handling & DB reset
      src/routes/__root.tsx
      Added RemoveDB component and client-only UI to delete IndexedDB, wired into ErrorComponent to detect "Failed query:" errors, render recovery UI with icon/button, manage loading/error states, and reload on success; updated SEO description and error header styling.

      Sequence Diagram(s)

      sequenceDiagram
          participant User
          participant ErrorUI as ErrorComponent
          participant RemoveDB
          participant Client
          participant IDB as IndexedDB
      
          User->>ErrorUI: Encounter DB query error
          ErrorUI->>ErrorUI: Detect "Failed query:" prefix
          ErrorUI->>User: Render DB-error block + RemoveDB button
          User->>RemoveDB: Click "Reset database"
          RemoveDB->>RemoveDB: set loading state
          RemoveDB->>Client: client.close()
          Client->>IDB: close connection
          RemoveDB->>IDB: deleteDatabase(idbName)
          alt delete success
              IDB-->>RemoveDB: success
              RemoveDB->>User: reload page
          else delete failure
              IDB-->>RemoveDB: error
              RemoveDB->>User: show error message
          end

      Estimated code review effort

      🎯 3 (Moderate) | ⏱️ ~20 minutes

      • PR #27: Adjusts HomeIntro prop usage from show_home_intro to intro in src/routes/_tutorial.tsx (same line changed).
      • PR #26: Related renaming/route handling for tutorial intro flag aligning with intro prop semantics.

      Pre-merge checks and finishing touches

      ❌ Failed checks (1 warning, 1 inconclusive)
      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.You can run @coderabbitai generate docstrings to improve docstring coverage.
      Title check❓ InconclusiveThe title 'Update the intro' is vague and generic, using non-descriptive language that doesn't convey meaningful information about the changeset's scope or primary purpose.Consider using a more specific title that reflects the main changes, such as 'Refactor HomeIntro component and add database reset functionality' to better summarize the substantial updates across multiple files.
      ✅ Passed checks (1 passed)
      Check nameStatusExplanation
      Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.

      📜 Recent review details

      Configuration used: Path: .coderabbit.yaml

      Review profile: CHILL

      Plan: Pro

      📥 Commits

      Reviewing files that changed from the base of the PR and between 37e71bc6cae2638a53ef2f8f4b2a761443717de9 and 05a40ffb96eaffe9ba07406a56d4545f424e2ce7.

      📒 Files selected for processing (2)
      • src/components/HomeIntro.tsx
      • src/db/index.ts

      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    2. 🚀 Preview Deployment

      Status: ✅ Ready!

      Preview URL: Open Preview

      Commit: 05a40ffb96eaffe9ba07406a56d4545f424e2ce7

      Built and deployed successfully

    3. fuko merged thisd5e0120

    4. fuko closed this

    5. Actionable comments posted: 3

      🧹 Nitpick comments (1)
      src/routes/__root.tsx (1)

      71-71: Remove debug logging.

      The console.log({ idbName }) appears to be leftover debug code that should be removed before merging.

      🔎 Proposed fix
        const removeDB = useCallback(async () => {
          if (typeof window !== "undefined" && "indexedDB" in window) {
            try {
      -        console.log({ idbName });
              await client.close();
      📜 Review details

      Configuration used: Path: .coderabbit.yaml

      Review profile: CHILL

      Plan: Pro

      📥 Commits

      Reviewing files that changed from the base of the PR and between 89dd97a56ce7f63df9f6fc8ac1d62aa2269488ae and 37e71bc6cae2638a53ef2f8f4b2a761443717de9.

      ⛔ Files ignored due to path filters (8)
      • public/android-chrome-192x192.png is excluded by !**/*.png
      • public/android-chrome-512x512.png is excluded by !**/*.png
      • public/apple-touch-icon.png is excluded by !**/*.png
      • public/favicon-16x16.png is excluded by !**/*.png
      • public/favicon-32x32.png is excluded by !**/*.png
      • public/favicon.ico is excluded by !**/*.ico
      • public/og-image.png is excluded by !**/*.png
      • public/twitter-card.png is excluded by !**/*.png
      📒 Files selected for processing (4)
      • src/components/HomeIntro.tsx
      • src/db/index.ts
      • src/routes/__root.tsx
      • src/routes/_tutorial.tsx
      🧰 Additional context used
      📓 Path-based instructions (2)
      src/**/*.{tsx,ts}

      📄 CodeRabbit inference engine (AGENTS.md)

      src/**/*.{tsx,ts}: The project uses TanStack Start framework (@tanstack/start) with React for the frontend Use shadcn/ui for UI components

      Files:

      • src/routes/_tutorial.tsx
      • src/components/HomeIntro.tsx
      • src/routes/__root.tsx
      • src/db/index.ts
      src/**/*.{tsx,ts,css}

      📄 CodeRabbit inference engine (AGENTS.md)

      Use tailwindcss (v4) for styling

      Files:

      • src/routes/_tutorial.tsx
      • src/components/HomeIntro.tsx
      • src/routes/__root.tsx
      • src/db/index.ts
      🧠 Learnings (5)
      📚 Learning: 2025-12-24T15:55:57.531Z
      Learnt from: CR
      Repo: fulopkovacs/trytanstackdb.com PR: 0
      File: AGENTS.md:0-0
      Timestamp: 2025-12-24T15:55:57.531Z
      Learning: Applies to src/route/__root.tsx : The root route is located at `src/route/__root.tsx` in TanStack Start

      Applied to files:

      • src/routes/_tutorial.tsx
      • src/components/HomeIntro.tsx
      • src/routes/__root.tsx
      📚 Learning: 2025-12-24T15:55:57.531Z
      Learnt from: CR
      Repo: fulopkovacs/trytanstackdb.com PR: 0
      File: AGENTS.md:0-0
      Timestamp: 2025-12-24T15:55:57.531Z
      Learning: Applies to src/**/*route*.{tsx,ts} : Use TanStack Router (`tanstack/router`) for routing

      Applied to files:

      • src/routes/_tutorial.tsx
      • src/components/HomeIntro.tsx
      • src/routes/__root.tsx
      📚 Learning: 2025-12-24T15:25:07.106Z
      Learnt from: fulopkovacs
      Repo: fulopkovacs/trytanstackdb.com PR: 22
      File: src/components/TodoBoards.tsx:63-81
      Timestamp: 2025-12-24T15:25:07.106Z
      Learning: In Tailwind CSS v4, prefer canonical classes using bg-linear-to-* (e.g., bg-linear-to-b, bg-linear-to-t, bg-linear-to-r) over the older bg-gradient-to-* syntax. This aligns with Tailwind LSP's suggestCanonicalClasses rule. Apply across TSX files (e.g., src/components/*.tsx); replace occurrences of bg-gradient-to-* with the corresponding bg-linear-to-* equivalents and verify gradients visually.

      Applied to files:

      • src/routes/_tutorial.tsx
      • src/components/HomeIntro.tsx
      • src/routes/__root.tsx
      📚 Learning: 2025-12-24T15:55:57.531Z
      Learnt from: CR
      Repo: fulopkovacs/trytanstackdb.com PR: 0
      File: AGENTS.md:0-0
      Timestamp: 2025-12-24T15:55:57.531Z
      Learning: Applies to src/**/*.{tsx,ts} : The project uses TanStack Start framework (`tanstack/start`) with React for the frontend

      Applied to files:

      • src/components/HomeIntro.tsx
      📚 Learning: 2025-12-24T15:55:57.531Z
      Learnt from: CR
      Repo: fulopkovacs/trytanstackdb.com PR: 0
      File: AGENTS.md:0-0
      Timestamp: 2025-12-24T15:55:57.531Z
      Learning: Applies to src/**/*.{tsx,ts} : Use `shadcn/ui` for UI components

      Applied to files:

      • src/routes/__root.tsx
      🧬 Code graph analysis (3)
      src/routes/_tutorial.tsx (1)
      src/components/HomeIntro.tsx (1)
      • HomeIntro (31-139)
      src/components/HomeIntro.tsx (2)
      src/components/ui/card.tsx (5)
      • Card (85-85)
      • CardHeader (86-86)
      • CardTitle (88-88)
      • CardContent (91-91)
      • CardFooter (87-87)
      src/components/ui/button.tsx (1)
      • Button (63-63)
      src/routes/__root.tsx (4)
      src/db/index.ts (2)
      • client (11-11)
      • idbName (9-9)
      public/sw.js (1)
      • client (66-66)
      src/components/ui/button.tsx (1)
      • Button (63-63)
      src/components/ui/card.tsx (2)
      • Card (85-85)
      • CardHeader (86-86)
      🪛 GitHub Actions: CI/CD
      src/components/HomeIntro.tsx

      [warning] 1-1: assist/source/organizeImports: Imports/exports are not sorted. Organize imports.

      🔇 Additional comments (9)
      src/routes/_tutorial.tsx (1)

      42-42: LGTM!

      The prop rename from show_home_intro to intro aligns correctly with the refactored HomeIntro component interface, and the type matches the search param schema.

      src/db/index.ts (1)

      4-9: LGTM!

      Exposing dbName and idbName as public exports enables the database reset functionality in the error UI. The JSDoc comment clearly documents the purpose of idbName, and the string transformation correctly derives the IndexedDB path from the PGlite connection string.

      src/routes/__root.tsx (3)

      65-109: Well-structured IndexedDB reset implementation.

      Good handling of the onblocked event with a user-friendly message about closing other tabs. The ClientOnly wrapper appropriately guards against SSR execution, and closing the PGlite client before deletion prevents resource conflicts.


      123-124: LGTM!

      The text-destructive class ensures the error title is visible in light mode, addressing the PR objective. The TriangleAlertIcon provides a clear visual indicator.


      141-148: LGTM!

      The new error branch provides helpful context for database query failures and offers users an actionable recovery option through RemoveDB.

      src/components/HomeIntro.tsx (4)

      15-29: LGTM!

      Clean, focused presentation components. Keeping them private to this file is appropriate since they're only used for the intro modal's styling.


      64-64: LGTM!

      The backdrop-blur-xs addition enhances the modal overlay effect.


      70-75: LGTM!

      The ALPHA → BETA label change reflects the project's maturity progression.


      110-116: LGTM!

      The button text change from "Start tutorial" to "Get started" is clearer and more inviting.

      OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)
      src/components/HomeIntro.tsx lines 97 to 98Outdated
      @@ -106,8 +86,13 @@
      106- </li>
      107- ))}
      108- </ul>
      109- <p>
      110- Follow the guide, inspect the requests, check the source code,
      111- have fun!
      112- </p>
      113- </div>
      86+ </a>{" "}
      87+ is a library that makes it really easy to build ⚡blazing fast⚡
      88+ front-ends.
      89+ </p>
      90+ <WavyLine />
      91+ <ul className="pl-4">
      92+ <FeatureItem>
      93+ <Bold>user actions feel instant</Bold> – updates show
      94+ immediately while sync happens in the background
      95+ </FeatureItem>
      96+ <FeatureItem>
      97+ <Bold>fetch data once, use everywhere</Bold> – Tanstack DB
      98+ keeps it up to date

      ⚠️ Potential issue | 🟡 Minor

      Typo: "Tanstack" should be "TanStack".

      The brand name uses a capital "S" - "TanStack DB" (as correctly used on line 85).

      🔎 Proposed fix
                      <FeatureItem>
      -                  <Bold>fetch data once, use everywhere</Bold> – Tanstack DB
      +                  <Bold>fetch data once, use everywhere</Bold> – TanStack DB
                        keeps it up to date
                      </FeatureItem>
      📝 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.

                        <Bold>fetch data once, use everywhere</Bold> – TanStack DB
                        keeps it up to date
      🤖 Prompt for AI Agents
      In src/components/HomeIntro.tsx around lines 97 to 98, the brand name "Tanstack"
      is misspelled with a lowercase "s"; change it to "TanStack" to match the correct
      product casing (consistent with line 85). Update the text node so the string
      reads "TanStack DB" and ensure any surrounding punctuation/spacing remains
      unchanged.
      src/routes/__root.tsx lines 116 to 117Outdated
      @@ -60,5 +97,21 @@
      97+ return (
      98+ <ClientOnly>
      99+ <Button
      100+ className="w-fit mx-auto"
      101+ variant="destructive"
      102+ onClick={removeDB}
      103+ >
      104+ <RotateCwIcon /> Reset the db
      105+ </Button>
      106+ <p className="text-destructive font-bold text-center">{errorMessage}</p>
      107+ </ClientOnly>
      108+ );
      109+}
      110+
      60111 function ErrorComponent({ error }: { error: unknown }) {
      61112 const isServiceWorkerError =
      62113 error instanceof Error &&
      63114 error.message.includes("navigator.serviceWorker.addEventListener");
      64115
      116+ const isDbQueryError =
      117+ error instanceof Error && error.message.startsWith("Failed query: ");

      ⚠️ Potential issue | 🔴 Critical

      🧩 Analysis chain

      🏁 Script executed:

      #!/bin/bash
      # Search for occurrences of "Failed query" to verify the error message pattern is consistent
      rg -n "Failed query" --type=ts --type=tsx -C2

      Repository: fulopkovacs/trytanstackdb.com

      Length of output: 100


      🏁 Script executed:

      #!/bin/bash
      # Search for occurrences of "Failed query" in the codebase
      rg -n "Failed query" src/

      Repository: fulopkovacs/trytanstackdb.com

      Length of output: 172


      🏁 Script executed:

      #!/bin/bash
      # Search for where DB query errors might be thrown
      rg -n "throw.*Error" src/ -A1 -B1 | head -100

      Repository: fulopkovacs/trytanstackdb.com

      Length of output: 2878


      🏁 Script executed:

      #!/bin/bash
      # Search for database query execution and error handling patterns
      rg -n "query" src/ -i --max-count=30 | grep -i "error\|throw\|failed"

      Repository: fulopkovacs/trytanstackdb.com

      Length of output: 534


      🏁 Script executed:

      #!/bin/bash
      # Look for server-side route handlers and API endpoints
      git ls-files src/routes | head -20

      Repository: fulopkovacs/trytanstackdb.com

      Length of output: 342


      🏁 Script executed:

      #!/bin/bash
      # Check one of the database route files for query execution patterns
      head -100 src/routes/_tutorial._db.tsx

      Repository: fulopkovacs/trytanstackdb.com

      Length of output: 761


      🏁 Script executed:

      #!/bin/bash
      # Search for database query execution and error handling
      rg -n "executeQuery\|exec\|query" src/client/ src/server/ -i | head -50

      Repository: fulopkovacs/trytanstackdb.com

      Length of output: 55


      🏁 Script executed:

      #!/bin/bash
      # Search for db operations and query patterns in the codebase
      rg -n "createQuery\|useQuery\|\.query\|db\." src/ -A2 | grep -i "error\|throw\|catch" -B2 -A2 | head -80

      Repository: fulopkovacs/trytanstackdb.com

      Length of output: 55


      🏁 Script executed:

      #!/bin/bash
      # Read the __root.tsx file to understand the error handling context
      sed -n '100,150p' src/routes/__root.tsx | cat -n

      Repository: fulopkovacs/trytanstackdb.com

      Length of output: 2273


      🏁 Script executed:

      #!/bin/bash
      # Check package.json for TanStack DB version
      cat package.json | grep -A5 -B5 "tanstack\|@tanstack"

      Repository: fulopkovacs/trytanstackdb.com

      Length of output: 908


      🌐 Web query:

      TanStack DB error messages "Failed query" framework

      💡 Result:

      Short answer: TanStack DB surfaces a "Failed query" (or similar) when a query function throws and the query/collection enters an error state after retries (or immediately if retries are disabled). The DB exposes named error classes, per-collection error state and helpers (lastError, isError, errorCount, clearError) and you control retry/behavior via the query/Client retry options (or per-query retry function). See the error-handling docs and the query-retries guide for details and how to inspect the actual error object or change retry behavior. [1][2]

      Key links:

      • TanStack DB — Error handling: named error classes, lastError/isError/errorCount, clearError. [1]
      • TanStack Query — Query retries (how/when errors become final). [2]

      🌐 Web query:

      @tanstack/db "Failed query" error message format

      💡 Result:

      Do you mean the exact text/structure of the runtime error that @tanstack/db emits when a query fails (so you can parse logs), or do you want example stack traces / error classes (e.g., QueryCollectionError, CollectionInErrorStateError, SchemaValidationError)?


      🌐 Web query:

      TanStack DB error classes QueryCollectionError message format

      💡 Result:

      Short answer: QueryCollectionError is the base error class for query-collection-specific errors in TanStack DB; it inherits Error and exposes a string message (set by each subclass's constructor). See the QueryCollectionError-derived classes (e.g., QueryKeyRequiredError, QueryClientRequiredError, UnknownOperationTypeError) in the docs — each subclass overrides the constructor and provides the message string. [1][2]

      Sources:

      • QueryKeyRequiredError (extends QueryCollectionError) — shows inherited message property. [1]
      • QueryClientRequiredError / UnknownOperationTypeError docs (extends QueryCollectionError; message is string). [2]

      🌐 Web query:

      site:tanstack.com "Failed query" db

      💡 Result:

      I searched tanstack.com for references about failed queries and DB behavior — relevant docs cover useQuery failure state, retry behavior, and failureCount/failureReason. Key pages:

      • useQuery (React) — lists error/failure fields and retry options. (tanstack.com)
      • useQuery (Vue/Solid) — similar fields (failureCount, failureReason, throwOnError). (tanstack.com)
      • Query Retries guide — explains automatic retries (default 3) and how to configure them. (tanstack.com)

      If you want, I can open a specific page or search for the exact phrase "Failed query" within tanstack.com and return matching lines.

      Citations:


      The "Failed query: " error detection code will never execute in practice.

      The codebase has no application code throwing errors with the "Failed query: " prefix, and TanStack DB framework error classes do not produce this message format. This means the isDbQueryError conditional branch (line 142) providing context-specific help for database errors is unreachable dead code. Either the error message prefix should be corrected to match what TanStack DB actually throws, or this defensive error handling should be removed if database query errors are not expected to be caught here.

Sign in to join this conversation.