Skip to content

Conversation

@birkskyum
Copy link
Member

@birkskyum birkskyum commented Nov 12, 2025

Summary by CodeRabbit

  • New Features
    • Added a new "Authenticated Routes" Solid example showcasing Firebase-backed authentication: protected routes with redirect guards, login/logout flow (GitHub OAuth), an authenticated dashboard, invoice listing/detail views, simulated data loading, Tailwind styling, and starter configuration plus setup documentation and environment templates.

@nx-cloud
Copy link

nx-cloud bot commented Nov 12, 2025

View your CI Pipeline Execution ↗ for commit 5a3680a

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

☁️ Nx Cloud last updated this comment at 2025-11-12 00:20:29 UTC

@github-actions github-actions bot added the documentation Everything documentation related label Nov 12, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 12, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

A new Solid.js "Authenticated Routes" example was added: documentation entry plus a full example project demonstrating Firebase-based authentication, protected routes, route guards, loaders, generated route types, and Tailwind styling.

Changes

Cohort / File(s) Summary
Documentation
docs/router/config.json
Added "Authenticated Routes" entry to Solid Router Examples list linking to framework/solid/examples/authenticated-routes.
Example project scaffolding
examples/solid/authenticated-routes-firebase/{.env.example,.gitignore,.vscode/settings.json,README.md,index.html,package.json,tsconfig.json,vite.config.js,postcss.config.mjs}
New Vite+Solid example project files: env template, gitignore, VSCode settings, README, HTML entry, package & build configs, TypeScript config, PostCSS config.
Firebase init & typings
examples/solid/authenticated-routes-firebase/src/{firebase/config.ts,vite.d.ts}
Firebase app initialization using Vite env vars and exported auth; Vite env type declarations.
Auth context & utils
examples/solid/authenticated-routes-firebase/src/{auth.tsx,utils.ts}
Solid AuthContextProvider, useAuth hook, login/logout flows using Firebase, and exported sleep utility.
Routing entry & router wiring
examples/solid/authenticated-routes-firebase/src/main.tsx, examples/solid/authenticated-routes-firebase/src/routes/__root.tsx
Router provider setup with AuthContextProvider, scroll restoration, router registration augmentation, and root route creating typed context.
Public & protected routes
examples/solid/authenticated-routes-firebase/src/routes/{index.tsx,login.tsx,_auth.tsx,_auth.dashboard.tsx}
Home and login pages; _auth protected layout with beforeLoad guard and logout; dashboard route consuming auth.
Invoices routes & loaders
examples/solid/authenticated-routes-firebase/src/routes/{_auth.invoices.tsx,_auth.invoices.index.tsx,_auth.invoices.$invoiceId.tsx}
Invoices listing route with loader using fetchInvoices, nested index, and dynamic invoice detail route with loader using fetchInvoiceById.
Data fetching & caching
examples/solid/authenticated-routes-firebase/src/posts.tsx
Lazy cached fetchers fetchInvoices() and fetchInvoiceById(id) with single-load semantics and optional artificial delay.
Generated route types
examples/solid/authenticated-routes-firebase/src/routeTree.gen.ts
Generated route tree, exported route/type interfaces, and module augmentation for @tanstack/solid-router file-route mappings.
Styling
examples/solid/authenticated-routes-firebase/src/styles.css
Tailwind integration, global styles, color-scheme and border-color settings.
Misc files
examples/solid/authenticated-routes-firebase/route files & configs
Misc supporting files added for the example (see above cohorts for specifics).

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App as App/Main
    participant Auth as AuthContext
    participant Firebase
    participant Router as TanStack Router
    participant Route as Protected Route

    User->>App: Open app
    App->>Auth: Mount AuthContextProvider
    Auth->>Firebase: init & subscribe onAuthStateChanged
    Firebase-->>Auth: current user (or null)
    Auth-->>App: isInitialLoading -> false

    rect rgb(240,220,240)
    Note over User,Router: Unauthenticated navigation
    User->>Router: Navigate to /_auth/invoices
    Router->>Route: beforeLoad guard
    Route->>Auth: isAuthenticated()
    Auth-->>Route: false
    Route->>Router: redirect to /login?redirectTo=original
    Router-->>User: Render /login
    end

    rect rgb(220,240,220)
    Note over User,Firebase: Login flow
    User->>App: Click GitHub sign-in
    App->>Auth: login('github')
    Auth->>Firebase: signInWithPopup(GithubProvider)
    Firebase-->>Auth: authenticated user
    Auth-->>Router: trigger refresh / invalidate
    Router-->>User: navigate to original target
    end

    rect rgb(220,235,255)
    Note over User,Router: Authenticated navigation
    User->>Router: Navigate to /_auth/invoices
    Router->>Route: beforeLoad guard
    Route->>Auth: isAuthenticated()
    Auth-->>Route: true
    Route->>Route: loader -> fetchInvoices()
    Route-->>Router: render InvoicesRoute with data
    Router-->>User: Show invoices UI
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • Areas to focus on:
    • src/posts.tsx — caching, concurrency (single-load promise) and error paths.
    • src/auth.tsx — auth subscription lifecycle, state updates, and use of flushSync.
    • src/routes/_auth.tsx and src/routes/index.tsx — beforeLoad guards and redirect/query handling.
    • src/routeTree.gen.ts — generated types and module augmentation correctness.

Possibly related PRs

Suggested reviewers

  • brenelz

Poem

🐰 I hopped through routes both safe and wild,
With Firebase keys and loaders styled,
Guards set firm and invoices found,
A bouncy router, homeward bound —
Cheers from a rabbit, code compiled! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: adding a new authenticated routes Firebase example for Solid Router. It uses the conventional 'docs()' scope prefix and accurately reflects the primary addition of a comprehensive Firebase authentication example.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9d45c97 and 5a3680a.

📒 Files selected for processing (1)
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.dashboard.tsx (1 hunks)

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 12, 2025

More templates

@tanstack/arktype-adapter

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

@tanstack/directive-functions-plugin

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

@tanstack/eslint-plugin-router

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/server-functions-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/zod-adapter

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

commit: 5a3680a

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: 8

🧹 Nitpick comments (8)
examples/solid/authenticated-routes-firebase/src/utils.ts (1)

1-3: Consider adding an explicit return type.

The function implementation is correct. For improved TypeScript documentation and clarity, consider adding an explicit return type annotation.

Apply this diff to add the explicit return type:

-export async function sleep(ms: number) {
+export async function sleep(ms: number): Promise<void> {
   return new Promise((resolve) => setTimeout(resolve, ms))
 }
examples/solid/authenticated-routes-firebase/index.html (1)

6-6: Consider a more descriptive title.

The generic title "Vite App" could be more descriptive to reflect that this is an authenticated routes example with Firebase.

Apply this diff to use a more descriptive title:

-    <title>Vite App</title>
+    <title>Authenticated Routes - Firebase Example</title>
examples/solid/authenticated-routes-firebase/src/routes/_auth.tsx (1)

4-8: Remove debug console.log or use proper logging.

Lines 6, 14, and 22 contain console.log statements that should either be removed for production or replaced with a proper logging utility if debug output is needed in the example.

Apply this diff to remove the debug statements:

   beforeLoad: ({ context }) => {
-    // Log for debugging
-    console.log('Checking context on index.tsx:', context) // Check if user is authenticated
     if (context.auth.isAuthenticated()) {
-      console.log('User authenticated, proceeding...')
       throw redirect({

Or in _auth.tsx:

   beforeLoad: ({ context, location }) => {
     // Check if user is authenticated
     if (!context.auth.isAuthenticated()) {
-      console.log('User not authenticated, redirecting to login...')
       throw redirect({
         to: '/login',
         search: {
           redirect: location.href,
         },
       })
     }
-    console.log('User authenticated, proceeding...')
   },
examples/solid/authenticated-routes-firebase/src/firebase/config.ts (2)

4-5: Remove or address the TODO comment.

The TODO comment appears to be boilerplate from Firebase's setup template. Either remove it or add actual Firebase SDKs if needed for this example.

Apply this diff to remove the TODO:

 import { getAuth } from 'firebase/auth'
-// TODO: Add SDKs for Firebase products that you want to use
-// https://firebase.google.com/docs/web/setup#available-libraries
 
 // Your web app's Firebase configuration

7-19: Consider validating Firebase configuration at initialization.

The Firebase config reads from environment variables without validation. If any required variable is missing or empty, Firebase initialization will fail at runtime with potentially unclear error messages. Consider adding validation to provide clearer developer feedback.

Example validation approach:

// Your web app's Firebase configuration
const firebaseConfig = {
  apiKey: import.meta.env.VITE_PUBLIC_FIREBASE_API_KEY,
  authDomain: import.meta.env.VITE_PUBLIC_FIREBASE_AUTH_DOMAIN,
  projectId: import.meta.env.VITE_PUBLIC_FIREBASE_PROJECT_ID,
  storageBucket: import.meta.env.VITE_PUBLIC_FIREBASE_STORAGE_BUCKET,
  messagingSenderId: import.meta.env.VITE_PUBLIC_FIREBASE_MESSAGING_SENDER_ID,
  appId: import.meta.env.VITE_PUBLIC_FIREBASE_APP_ID,
}

// Validate required config values
const requiredKeys = ['apiKey', 'authDomain', 'projectId', 'appId'] as const
for (const key of requiredKeys) {
  if (!firebaseConfig[key]) {
    throw new Error(
      `Missing required Firebase config: VITE_PUBLIC_FIREBASE_${key.toUpperCase()}`
    )
  }
}

// Initialize Firebase
const app = initializeApp(firebaseConfig)
export const auth = getAuth(app)
examples/solid/authenticated-routes-firebase/src/routes/index.tsx (1)

3-15: Remove debug console.log or use proper logging.

The console.log statements on lines 6 and 8 should either be removed for production or replaced with a proper logging utility if debug output is needed in the example.

Apply this diff:

   beforeLoad: ({ context }) => {
-    // Log for debugging
-    console.log('Checking context on index.tsx:', context) // Check if user is authenticated
+    // Check if user is authenticated
     if (context.auth.isAuthenticated()) {
-      console.log('User authenticated, proceeding...')
       throw redirect({
         to: '/dashboard',
       })
     }
   },
examples/solid/authenticated-routes-firebase/src/routes/login.tsx (2)

37-56: Consider explicit navigation after login.

Currently, router.invalidate() is used to trigger route revalidation after login, relying on the route guards to handle redirection. While this works, consider using explicit navigation for clarity:

const search = Route.useSearch()

const handleSignIn = async (provider: 'github') => {
  console.log(`Clicked ${provider} sign in!`)
  try {
    const providers = {
      github: new GithubAuthProvider(),
    }

    const typedProvider =
      providers[provider] ??
      (() => {
        throw new Error('Invalid provider')
      })()

    await login(typedProvider)
    await router.navigate({ to: search.redirect || fallback })
  } catch (error) {
    console.error('Sign in error:', error)
  }
}

63-66: Add explicit type="button" attribute.

Instead of using a biome-ignore comment, explicitly add type="button" to prevent the button from acting as a form submit button.

Apply this diff:

-          {/* biome-ignore lint/a11y/useButtonType: <explanation> */}
           <button
+            type="button"
             class="w-full h-12 font-medium bg-background hover:bg-secondary border-2 transition-all hover:scale-[1.02]"
             onClick={() => handleSignIn('github')}
           >
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8f57746 and 9d45c97.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (26)
  • docs/router/config.json (1 hunks)
  • examples/solid/authenticated-routes-firebase/.env.example (1 hunks)
  • examples/solid/authenticated-routes-firebase/.gitignore (1 hunks)
  • examples/solid/authenticated-routes-firebase/.vscode/settings.json (1 hunks)
  • examples/solid/authenticated-routes-firebase/README.md (1 hunks)
  • examples/solid/authenticated-routes-firebase/index.html (1 hunks)
  • examples/solid/authenticated-routes-firebase/package.json (1 hunks)
  • examples/solid/authenticated-routes-firebase/postcss.config.mjs (1 hunks)
  • examples/solid/authenticated-routes-firebase/src/auth.tsx (1 hunks)
  • examples/solid/authenticated-routes-firebase/src/firebase/config.ts (1 hunks)
  • examples/solid/authenticated-routes-firebase/src/main.tsx (1 hunks)
  • examples/solid/authenticated-routes-firebase/src/posts.tsx (1 hunks)
  • examples/solid/authenticated-routes-firebase/src/routeTree.gen.ts (1 hunks)
  • examples/solid/authenticated-routes-firebase/src/routes/__root.tsx (1 hunks)
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.dashboard.tsx (1 hunks)
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.$invoiceId.tsx (1 hunks)
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.index.tsx (1 hunks)
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.tsx (1 hunks)
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.tsx (1 hunks)
  • examples/solid/authenticated-routes-firebase/src/routes/index.tsx (1 hunks)
  • examples/solid/authenticated-routes-firebase/src/routes/login.tsx (1 hunks)
  • examples/solid/authenticated-routes-firebase/src/styles.css (1 hunks)
  • examples/solid/authenticated-routes-firebase/src/utils.ts (1 hunks)
  • examples/solid/authenticated-routes-firebase/src/vite.d.ts (1 hunks)
  • examples/solid/authenticated-routes-firebase/tsconfig.json (1 hunks)
  • examples/solid/authenticated-routes-firebase/vite.config.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
examples/{react,solid}/**

📄 CodeRabbit inference engine (AGENTS.md)

Keep example applications under examples/react/ and examples/solid/

Files:

  • examples/solid/authenticated-routes-firebase/postcss.config.mjs
  • examples/solid/authenticated-routes-firebase/src/firebase/config.ts
  • examples/solid/authenticated-routes-firebase/src/styles.css
  • examples/solid/authenticated-routes-firebase/src/routes/index.tsx
  • examples/solid/authenticated-routes-firebase/src/vite.d.ts
  • examples/solid/authenticated-routes-firebase/src/routes/login.tsx
  • examples/solid/authenticated-routes-firebase/vite.config.js
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.tsx
  • examples/solid/authenticated-routes-firebase/src/auth.tsx
  • examples/solid/authenticated-routes-firebase/src/utils.ts
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.dashboard.tsx
  • examples/solid/authenticated-routes-firebase/index.html
  • examples/solid/authenticated-routes-firebase/README.md
  • examples/solid/authenticated-routes-firebase/src/routes/__root.tsx
  • examples/solid/authenticated-routes-firebase/src/main.tsx
  • examples/solid/authenticated-routes-firebase/src/posts.tsx
  • examples/solid/authenticated-routes-firebase/src/routeTree.gen.ts
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.tsx
  • examples/solid/authenticated-routes-firebase/package.json
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.index.tsx
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.$invoiceId.tsx
  • examples/solid/authenticated-routes-firebase/tsconfig.json
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript in strict mode with extensive type safety across the codebase

Files:

  • examples/solid/authenticated-routes-firebase/src/firebase/config.ts
  • examples/solid/authenticated-routes-firebase/src/routes/index.tsx
  • examples/solid/authenticated-routes-firebase/src/vite.d.ts
  • examples/solid/authenticated-routes-firebase/src/routes/login.tsx
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.tsx
  • examples/solid/authenticated-routes-firebase/src/auth.tsx
  • examples/solid/authenticated-routes-firebase/src/utils.ts
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.dashboard.tsx
  • examples/solid/authenticated-routes-firebase/src/routes/__root.tsx
  • examples/solid/authenticated-routes-firebase/src/main.tsx
  • examples/solid/authenticated-routes-firebase/src/posts.tsx
  • examples/solid/authenticated-routes-firebase/src/routeTree.gen.ts
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.tsx
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.index.tsx
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.$invoiceId.tsx
docs/{router,start}/**

📄 CodeRabbit inference engine (AGENTS.md)

Place router docs under docs/router/ and start framework docs under docs/start/

Files:

  • docs/router/config.json
**/src/routes/**

📄 CodeRabbit inference engine (AGENTS.md)

Place file-based routes under src/routes/ directories

Files:

  • examples/solid/authenticated-routes-firebase/src/routes/index.tsx
  • examples/solid/authenticated-routes-firebase/src/routes/login.tsx
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.tsx
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.dashboard.tsx
  • examples/solid/authenticated-routes-firebase/src/routes/__root.tsx
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.tsx
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.index.tsx
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.$invoiceId.tsx
**/package.json

📄 CodeRabbit inference engine (AGENTS.md)

Use workspace:* protocol for internal dependencies in package.json files

Files:

  • examples/solid/authenticated-routes-firebase/package.json
🧠 Learnings (10)
📓 Common learnings
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.598Z
Learning: Applies to packages/{react-router,solid-router}/** : Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/
Learnt from: FatahChan
Repo: TanStack/router PR: 5475
File: e2e/react-start/basic-prerendering/src/routes/redirect/$target/via-beforeLoad.tsx:8-0
Timestamp: 2025-10-14T18:59:33.990Z
Learning: In TanStack Router e2e test files, when a route parameter is validated at the route level (e.g., using zod in validateSearch or param validation), switch statements on that parameter do not require a default case, as the validation ensures only expected values will reach the switch.
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.598Z
Learning: Applies to packages/{react-router,solid-router}/** : Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/

Applied to files:

  • docs/router/config.json
  • examples/solid/authenticated-routes-firebase/src/routes/index.tsx
  • examples/solid/authenticated-routes-firebase/src/routes/login.tsx
  • examples/solid/authenticated-routes-firebase/vite.config.js
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.tsx
  • examples/solid/authenticated-routes-firebase/src/routes/__root.tsx
  • examples/solid/authenticated-routes-firebase/src/main.tsx
  • examples/solid/authenticated-routes-firebase/src/routeTree.gen.ts
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.tsx
  • examples/solid/authenticated-routes-firebase/package.json
  • examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.index.tsx
  • examples/solid/authenticated-routes-firebase/tsconfig.json
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.598Z
Learning: Applies to examples/{react,solid}/** : Keep example applications under examples/react/ and examples/solid/

Applied to files:

  • docs/router/config.json
📚 Learning: 2025-10-01T18:31:35.420Z
Learnt from: schiller-manuel
Repo: TanStack/router PR: 5330
File: e2e/react-start/custom-basepath/src/routeTree.gen.ts:58-61
Timestamp: 2025-10-01T18:31:35.420Z
Learning: Do not review files named `routeTree.gen.ts` in TanStack Router repositories, as these are autogenerated files that should not be manually modified.

Applied to files:

  • examples/solid/authenticated-routes-firebase/.gitignore
  • examples/solid/authenticated-routes-firebase/.vscode/settings.json
  • examples/solid/authenticated-routes-firebase/src/routes/__root.tsx
  • examples/solid/authenticated-routes-firebase/src/main.tsx
  • examples/solid/authenticated-routes-firebase/src/routeTree.gen.ts
📚 Learning: 2025-10-08T08:11:47.088Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 5402
File: packages/router-generator/tests/generator/no-formatted-route-tree/routeTree.nonnested.snapshot.ts:19-21
Timestamp: 2025-10-08T08:11:47.088Z
Learning: Test snapshot files in the router-generator tests directory (e.g., files matching the pattern `packages/router-generator/tests/generator/**/routeTree*.snapshot.ts` or `routeTree*.snapshot.js`) should not be modified or have issues flagged, as they are fixtures used to verify the generator's output and are intentionally preserved as-is.

Applied to files:

  • examples/solid/authenticated-routes-firebase/.gitignore
  • examples/solid/authenticated-routes-firebase/.vscode/settings.json
  • examples/solid/authenticated-routes-firebase/src/routes/__root.tsx
  • examples/solid/authenticated-routes-firebase/src/main.tsx
  • examples/solid/authenticated-routes-firebase/src/routeTree.gen.ts
📚 Learning: 2025-11-02T16:16:24.898Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 5732
File: packages/start-client-core/src/client/hydrateStart.ts:6-9
Timestamp: 2025-11-02T16:16:24.898Z
Learning: In packages/start-client-core/src/client/hydrateStart.ts, the `import/no-duplicates` ESLint disable is necessary for imports from `#tanstack-router-entry` and `#tanstack-start-entry` because both aliases resolve to the same placeholder file (`fake-start-entry.js`) in package.json during static analysis, even though they resolve to different files at runtime.

Applied to files:

  • examples/solid/authenticated-routes-firebase/src/main.tsx
  • examples/solid/authenticated-routes-firebase/src/routeTree.gen.ts
  • examples/solid/authenticated-routes-firebase/package.json
  • examples/solid/authenticated-routes-firebase/tsconfig.json
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.598Z
Learning: Applies to packages/router-core/** : Keep framework-agnostic core router logic in packages/router-core/

Applied to files:

  • examples/solid/authenticated-routes-firebase/src/main.tsx
  • examples/solid/authenticated-routes-firebase/src/routeTree.gen.ts
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.598Z
Learning: Applies to packages/{router-cli,router-generator,router-plugin,virtual-file-routes}/** : Keep CLI, generators, bundler plugins, and virtual file routing utilities in their dedicated tooling package directories

Applied to files:

  • examples/solid/authenticated-routes-firebase/src/routeTree.gen.ts
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.598Z
Learning: Applies to **/src/routes/** : Place file-based routes under src/routes/ directories

Applied to files:

  • examples/solid/authenticated-routes-firebase/src/routeTree.gen.ts
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.598Z
Learning: Applies to **/*.{ts,tsx} : Use TypeScript in strict mode with extensive type safety across the codebase

Applied to files:

  • examples/solid/authenticated-routes-firebase/tsconfig.json
🧬 Code graph analysis (10)
examples/solid/authenticated-routes-firebase/src/routes/index.tsx (3)
examples/solid/authenticated-routes-firebase/src/routes/_auth.tsx (1)
  • Route (10-25)
examples/solid/authenticated-routes-firebase/src/routes/login.tsx (1)
  • Route (21-31)
examples/solid/authenticated-routes-firebase/src/routes/__root.tsx (1)
  • Route (9-16)
examples/solid/authenticated-routes-firebase/src/routes/login.tsx (4)
examples/solid/authenticated-routes-firebase/src/routes/_auth.tsx (1)
  • Route (10-25)
examples/solid/authenticated-routes-firebase/src/routes/index.tsx (1)
  • Route (3-15)
examples/solid/authenticated-routes-firebase/src/routes/__root.tsx (1)
  • Route (9-16)
examples/solid/authenticated-routes-firebase/src/auth.tsx (1)
  • useAuth (57-63)
examples/solid/authenticated-routes-firebase/src/routes/_auth.tsx (7)
examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.$invoiceId.tsx (1)
  • Route (4-11)
examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.tsx (1)
  • Route (5-10)
examples/solid/authenticated-routes-firebase/src/routes/index.tsx (1)
  • Route (3-15)
examples/solid/authenticated-routes-firebase/src/routes/login.tsx (1)
  • Route (21-31)
examples/solid/authenticated-routes-firebase/src/routes/_auth.dashboard.tsx (1)
  • Route (5-7)
examples/solid/authenticated-routes-firebase/src/routes/__root.tsx (1)
  • Route (9-16)
examples/solid/authenticated-routes-firebase/src/auth.tsx (1)
  • useAuth (57-63)
examples/solid/authenticated-routes-firebase/src/auth.tsx (2)
examples/solid/authenticated-routes/src/auth.tsx (2)
  • AuthProvider (28-55)
  • AuthContext (5-10)
examples/solid/authenticated-routes-firebase/src/firebase/config.ts (1)
  • auth (19-19)
examples/solid/authenticated-routes-firebase/src/routes/_auth.dashboard.tsx (1)
examples/solid/authenticated-routes-firebase/src/auth.tsx (1)
  • useAuth (57-63)
examples/solid/authenticated-routes-firebase/src/routes/__root.tsx (4)
examples/solid/authenticated-routes-firebase/src/auth.tsx (1)
  • AuthContextType (8-14)
examples/solid/authenticated-routes-firebase/src/routes/_auth.tsx (1)
  • Route (10-25)
examples/solid/authenticated-routes-firebase/src/routes/index.tsx (1)
  • Route (3-15)
examples/solid/authenticated-routes-firebase/src/routes/login.tsx (1)
  • Route (21-31)
examples/solid/authenticated-routes-firebase/src/main.tsx (2)
examples/solid/authenticated-routes-firebase/src/firebase/config.ts (1)
  • auth (19-19)
examples/solid/authenticated-routes-firebase/src/auth.tsx (2)
  • useAuth (57-63)
  • AuthContextProvider (18-55)
examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.tsx (5)
examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.$invoiceId.tsx (1)
  • Route (4-11)
examples/solid/authenticated-routes-firebase/src/routes/_auth.tsx (1)
  • Route (10-25)
examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.index.tsx (1)
  • Route (3-5)
examples/solid/authenticated-routes-firebase/src/routes/__root.tsx (1)
  • Route (9-16)
examples/solid/authenticated-routes-firebase/src/posts.tsx (1)
  • fetchInvoices (36-38)
examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.index.tsx (3)
examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.$invoiceId.tsx (1)
  • Route (4-11)
examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.tsx (1)
  • Route (5-10)
examples/solid/authenticated-routes-firebase/src/routes/_auth.tsx (1)
  • Route (10-25)
examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.$invoiceId.tsx (3)
examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.tsx (1)
  • Route (5-10)
examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.index.tsx (1)
  • Route (3-5)
examples/solid/authenticated-routes-firebase/src/posts.tsx (1)
  • fetchInvoiceById (40-50)
🪛 dotenv-linter (4.0.0)
examples/solid/authenticated-routes-firebase/.env.example

[warning] 7-7: [UnorderedKey] The VITE_PUBLIC_FIREBASE_MESSAGING_SENDER_ID key should go before the VITE_PUBLIC_FIREBASE_PROJECT_ID key

(UnorderedKey)


[warning] 8-8: [UnorderedKey] The VITE_PUBLIC_FIREBASE_APP_ID key should go before the VITE_PUBLIC_FIREBASE_AUTH_DOMAIN key

(UnorderedKey)

🪛 ESLint
examples/solid/authenticated-routes-firebase/src/routes/login.tsx

[error] 5-5: 'useRouterState' is defined but never used.

(unused-imports/no-unused-imports)


[error] 10-10: 'GoogleAuthProvider' is defined but never used.

(unused-imports/no-unused-imports)


[error] 11-11: Member 'GithubAuthProvider' of the import declaration should be sorted alphabetically.

(sort-imports)


[error] 12-12: 'OAuthProvider' is defined but never used.

(unused-imports/no-unused-imports)


[error] 15-15: 'sleep' is defined but never used.

(unused-imports/no-unused-imports)


[error] 16-16: simple-icons import should occur before import of ../auth

(import/order)


[error] 16-16: 'siApple' is defined but never used.

(unused-imports/no-unused-imports)


[error] 16-16: 'siGoogle' is defined but never used.

(unused-imports/no-unused-imports)

🔇 Additional comments (15)
examples/solid/authenticated-routes-firebase/src/styles.css (1)

19-21: LGTM!

The body styling with background and text colors for both light and dark modes is well-implemented using Tailwind utilities.

examples/solid/authenticated-routes-firebase/postcss.config.mjs (1)

1-5: LGTM!

Standard PostCSS configuration for Tailwind CSS. The setup is correct and follows Tailwind v4 conventions.

examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.index.tsx (1)

1-5: LGTM!

The route definition is correct and serves as a proper index route placeholder for the invoices section.

examples/solid/authenticated-routes-firebase/src/vite.d.ts (1)

1-14: LGTM!

The ambient type declarations correctly define all Firebase configuration environment variables with proper readonly modifiers and standard Vite naming conventions.

examples/solid/authenticated-routes-firebase/src/routes/_auth.tsx (2)

10-25: LGTM!

The authentication guard correctly checks authentication status and redirects unauthenticated users to login while preserving the original location for post-login redirect.


27-40: LGTM!

The logout flow properly sequences confirmation, logout, router invalidation, and navigation. The use of .finally() ensures navigation happens regardless of invalidation outcome.

examples/solid/authenticated-routes-firebase/vite.config.js (1)

1-14: LGTM!

The Vite configuration correctly orders plugins (TanStack Router before Solid) and uses appropriate settings for a Solid.js application with code splitting enabled.

examples/solid/authenticated-routes-firebase/src/routes/index.tsx (1)

17-65: LGTM!

The home component provides clear, informative content explaining the template structure and authentication flow. The navigation links are appropriately styled and labeled.

examples/solid/authenticated-routes-firebase/src/routes/_auth.dashboard.tsx (1)

1-18: LGTM!

The dashboard route correctly consumes the authentication context and safely handles potentially missing user data with appropriate fallbacks.

examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.$invoiceId.tsx (1)

13-30: LGTM!

The component correctly uses Solid.js reactive patterns with Route.useLoaderData() and properly accesses the loader data through function calls.

examples/solid/authenticated-routes-firebase/src/main.tsx (3)

10-24: LGTM!

The router setup correctly initializes with a placeholder context (auth: undefined!) that will be properly provided by the RouterProvider at line 38. The module augmentation ensures type safety throughout the application.


26-39: LGTM!

The component correctly waits for initial auth state before rendering the router, preventing authentication-related UI flashes. The auth context is properly passed to the RouterProvider.


41-51: LGTM!

The application structure properly wraps the router with the authentication provider, establishing the correct context hierarchy.

examples/solid/authenticated-routes-firebase/src/routes/__root.tsx (1)

1-16: LGTM!

The root route correctly defines the typed router context with AuthContextType and sets up the component with Outlet and devtools. This establishes the foundation for typed, authenticated routing throughout the application.

examples/solid/authenticated-routes-firebase/src/auth.tsx (1)

57-63: LGTM!

The useAuth hook correctly validates that it's used within the provider context and provides proper error messaging.

Comment on lines +11 to +28
"dependencies": {
"@tailwindcss/postcss": "^4.1.15",
"@tanstack/solid-router": "^1.135.2",
"@tanstack/solid-router-devtools": "^1.135.2",
"@tanstack/router-plugin": "^1.135.2",
"firebase": "^11.4.0",
"postcss": "^8.5.1",
"solid-js": "^1.9.10",
"redaxios": "^0.5.1",
"simple-icons": "^14.9.0",
"tailwindcss": "^4.1.15",
"zod": "^3.24.2"
},
"devDependencies": {
"vite-plugin-solid": "^2.11.10",
"typescript": "^5.7.2",
"vite": "^7.1.7"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Use workspace:* for internal TanStack packages.

Per the repo guideline for package.json files, internal @tanstack/* deps should use the workspace protocol so the example stays in lockstep with the monorepo. Leaving the caret ranges pulls from npm instead of the local packages, risking mismatched or unreleased APIs.

As per coding guidelines

Apply this diff:

-    "@tanstack/solid-router": "^1.135.2",
-    "@tanstack/solid-router-devtools": "^1.135.2",
-    "@tanstack/router-plugin": "^1.135.2",
+    "@tanstack/solid-router": "workspace:*",
+    "@tanstack/solid-router-devtools": "workspace:*",
+    "@tanstack/router-plugin": "workspace:*",
📝 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
"dependencies": {
"@tailwindcss/postcss": "^4.1.15",
"@tanstack/solid-router": "^1.135.2",
"@tanstack/solid-router-devtools": "^1.135.2",
"@tanstack/router-plugin": "^1.135.2",
"firebase": "^11.4.0",
"postcss": "^8.5.1",
"solid-js": "^1.9.10",
"redaxios": "^0.5.1",
"simple-icons": "^14.9.0",
"tailwindcss": "^4.1.15",
"zod": "^3.24.2"
},
"devDependencies": {
"vite-plugin-solid": "^2.11.10",
"typescript": "^5.7.2",
"vite": "^7.1.7"
}
"dependencies": {
"@tailwindcss/postcss": "^4.1.15",
"@tanstack/solid-router": "workspace:*",
"@tanstack/solid-router-devtools": "workspace:*",
"@tanstack/router-plugin": "workspace:*",
"firebase": "^11.4.0",
"postcss": "^8.5.1",
"solid-js": "^1.9.10",
"redaxios": "^0.5.1",
"simple-icons": "^14.9.0",
"tailwindcss": "^4.1.15",
"zod": "^3.24.2"
},
"devDependencies": {
"vite-plugin-solid": "^2.11.10",
"typescript": "^5.7.2",
"vite": "^7.1.7"
}
🤖 Prompt for AI Agents
In examples/solid/authenticated-routes-firebase/package.json around lines 11 to
28, the internal @tanstack packages are using caret ranges which will pull from
npm instead of the monorepo; change the version specifiers for
"@tanstack/solid-router", "@tanstack/solid-router-devtools", and
"@tanstack/router-plugin" to use the workspace protocol (e.g. "workspace:*") so
the example resolves to the local packages and stays in lockstep with the repo;
ensure any other @tanstack/* entries in this file also use "workspace:*".

Comment on lines +27 to +32
````VITE_FIREBASE_API_KEY=
VITE_FIREBASE_AUTH_DOMAIN=
VITE_FIREBASE_PROJECT_ID=
VITE_FIREBASE_STORAGE_BUCKET=
VITE_FIREBASE_MESSAGING_SENDER_ID=
VITE_FIREBASE_APP_ID=```
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fix the environment variable names in the README.

.env.example (and the code that consumes it) expects the VITE_PUBLIC_FIREBASE_* variables, but this snippet directs readers to configure VITE_FIREBASE_*. Following the current instructions leaves the actual env vars unset at runtime, so auth never initializes. Please align the README with the real variable names.

Apply this diff to update the snippet:

-```VITE_FIREBASE_API_KEY=
-VITE_FIREBASE_AUTH_DOMAIN=
-VITE_FIREBASE_PROJECT_ID=
-VITE_FIREBASE_STORAGE_BUCKET=
-VITE_FIREBASE_MESSAGING_SENDER_ID=
-VITE_FIREBASE_APP_ID=```
+```VITE_PUBLIC_FIREBASE_API_KEY=
+VITE_PUBLIC_FIREBASE_AUTH_DOMAIN=
+VITE_PUBLIC_FIREBASE_PROJECT_ID=
+VITE_PUBLIC_FIREBASE_STORAGE_BUCKET=
+VITE_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=
+VITE_PUBLIC_FIREBASE_APP_ID=```
🤖 Prompt for AI Agents
In examples/solid/authenticated-routes-firebase/README.md around lines 27 to 32,
the README shows environment variable names prefixed with VITE_FIREBASE_* but
the project expects VITE_PUBLIC_FIREBASE_*; update the snippet to use
VITE_PUBLIC_FIREBASE_API_KEY, VITE_PUBLIC_FIREBASE_AUTH_DOMAIN,
VITE_PUBLIC_FIREBASE_PROJECT_ID, VITE_PUBLIC_FIREBASE_STORAGE_BUCKET,
VITE_PUBLIC_FIREBASE_MESSAGING_SENDER_ID, and VITE_PUBLIC_FIREBASE_APP_ID so
they match .env.example and the code that consumes them.

import * as Solid from 'solid-js'

import { onAuthStateChanged, signInWithPopup, signOut } from 'firebase/auth'
import { flushSync } from 'react-dom'
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Remove React import from Solid.js application.

This is a Solid.js application, but it's importing flushSync from react-dom. This is incorrect and will not work as intended. In Solid.js, state updates are already synchronous and tracked, so you should remove this import and the flushSync wrapper calls.

Apply this diff:

 import * as Solid from 'solid-js'
 
 import { onAuthStateChanged, signInWithPopup, signOut } from 'firebase/auth'
-import { flushSync } from 'react-dom'
 import { auth } from './firebase/config'
 import type { AuthProvider, User } from 'firebase/auth'

Then remove the flushSync wrappers at lines 25-28 and 42-45.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In examples/solid/authenticated-routes-firebase/src/auth.tsx around line 4, the
file incorrectly imports flushSync from 'react-dom' and uses flushSync wrappers
at lines 25-28 and 42-45; remove the import line "import { flushSync } from
'react-dom'" and delete the flushSync(...) wrapper calls so the Solid.js state
updates use native Solid mechanisms (simply perform the state updates directly
without flushSync).

Comment on lines +23 to +46
Solid.createEffect(() => {
const unsubscribe = onAuthStateChanged(auth, (user) => {
flushSync(() => {
setUser(user)
setIsInitialLoading(false)
})
})
return () => unsubscribe()
})

const logout = async () => {
console.log('Logging out...')
await signOut(auth)
setUser(null)
setIsInitialLoading(false)
}

const login = async (provider: AuthProvider) => {
const result = await signInWithPopup(auth, provider)
flushSync(() => {
setUser(result.user)
setIsInitialLoading(false)
})
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Remove flushSync wrappers - not needed in Solid.js.

The flushSync calls at lines 25-28 and 42-45 are not needed in Solid.js. Solid.js state updates are already synchronous and tracked by the reactivity system. Simply call the setters directly.

Apply this diff:

   Solid.createEffect(() => {
     const unsubscribe = onAuthStateChanged(auth, (user) => {
-      flushSync(() => {
-        setUser(user)
-        setIsInitialLoading(false)
-      })
+      setUser(user)
+      setIsInitialLoading(false)
     })
     return () => unsubscribe()
   })

   // ...

   const login = async (provider: AuthProvider) => {
     const result = await signInWithPopup(auth, provider)
-    flushSync(() => {
-      setUser(result.user)
-      setIsInitialLoading(false)
-    })
+    setUser(result.user)
+    setIsInitialLoading(false)
   }
📝 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
Solid.createEffect(() => {
const unsubscribe = onAuthStateChanged(auth, (user) => {
flushSync(() => {
setUser(user)
setIsInitialLoading(false)
})
})
return () => unsubscribe()
})
const logout = async () => {
console.log('Logging out...')
await signOut(auth)
setUser(null)
setIsInitialLoading(false)
}
const login = async (provider: AuthProvider) => {
const result = await signInWithPopup(auth, provider)
flushSync(() => {
setUser(result.user)
setIsInitialLoading(false)
})
}
Solid.createEffect(() => {
const unsubscribe = onAuthStateChanged(auth, (user) => {
setUser(user)
setIsInitialLoading(false)
})
return () => unsubscribe()
})
const logout = async () => {
console.log('Logging out...')
await signOut(auth)
setUser(null)
setIsInitialLoading(false)
}
const login = async (provider: AuthProvider) => {
const result = await signInWithPopup(auth, provider)
setUser(result.user)
setIsInitialLoading(false)
}
🤖 Prompt for AI Agents
In examples/solid/authenticated-routes-firebase/src/auth.tsx around lines 23 to
46, the review calls out unnecessary use of flushSync; remove the flushSync
wrappers around the state updates in both the onAuthStateChanged callback and
the login function and call setUser and setIsInitialLoading directly (i.e.,
replace flushSync(() => { setUser(...); setIsInitialLoading(...); }) with direct
setter calls), ensuring the unsubscribe return remains unchanged.

export const Route = createFileRoute('/_auth/invoices/$invoiceId')({
loader: async ({ params: { invoiceId } }) => {
return {
invoice: await fetchInvoiceById(Number.parseInt(invoiceId)),
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add radix parameter to Number.parseInt and consider validation.

The Number.parseInt call is missing the radix parameter (should be 10). Additionally, consider validating that the parsed result is a valid number before passing it to fetchInvoiceById.

Apply this diff:

-      invoice: await fetchInvoiceById(Number.parseInt(invoiceId)),
+      invoice: await fetchInvoiceById(Number.parseInt(invoiceId, 10)),
📝 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
invoice: await fetchInvoiceById(Number.parseInt(invoiceId)),
invoice: await fetchInvoiceById(Number.parseInt(invoiceId, 10)),
🤖 Prompt for AI Agents
In
examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.$invoiceId.tsx
around line 7, the Number.parseInt call is missing the radix and lacks
validation; change to Number.parseInt(invoiceId, 10) and validate the result
before calling fetchInvoiceById (e.g., const id = Number.parseInt(invoiceId,
10); if (Number.isNaN(id)) handle the invalid id case—throw an error, return a
400/redirect, or similar—otherwise pass id to fetchInvoiceById).

Comment on lines +20 to +34
{loaderData().invoices.map((invoice) => (
<li>
<Link
to="/invoices/$invoiceId"
params={{ invoiceId: invoice.id.toString() }}
class="text-blue-600 hover:opacity-75"
activeProps={{ class: 'font-bold underline' }}
>
<span class="tabular-nums">
#{invoice.id.toString().padStart(2, '0')}
</span>{' '}
- {invoice.title.slice(0, 16)}...
</Link>
</li>
))}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Add key to list items.

In Solid.js, when mapping over arrays to create elements, each item should have a unique key attribute for proper reconciliation and performance.

Apply this diff:

         <ol class="grid gap-2">
           {loaderData().invoices.map((invoice) => (
-            <li>
+            <li key={invoice.id}>
               <Link
📝 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
{loaderData().invoices.map((invoice) => (
<li>
<Link
to="/invoices/$invoiceId"
params={{ invoiceId: invoice.id.toString() }}
class="text-blue-600 hover:opacity-75"
activeProps={{ class: 'font-bold underline' }}
>
<span class="tabular-nums">
#{invoice.id.toString().padStart(2, '0')}
</span>{' '}
- {invoice.title.slice(0, 16)}...
</Link>
</li>
))}
{loaderData().invoices.map((invoice) => (
<li key={invoice.id}>
<Link
to="/invoices/$invoiceId"
params={{ invoiceId: invoice.id.toString() }}
class="text-blue-600 hover:opacity-75"
activeProps={{ class: 'font-bold underline' }}
>
<span class="tabular-nums">
#{invoice.id.toString().padStart(2, '0')}
</span>{' '}
- {invoice.title.slice(0, 16)}...
</Link>
</li>
))}
🤖 Prompt for AI Agents
In examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.tsx
around lines 20 to 34, the mapped <li> elements lack a unique key, which Solid
needs for correct list reconciliation; add a stable unique key prop to each <li>
(e.g., key={invoice.id} or key={invoice.id.toString()}) so each list item has a
unique identifier.

Comment on lines +1 to +16
import {
createFileRoute,
redirect,
useRouter,
useRouterState,
} from '@tanstack/solid-router'
import { z } from 'zod'

import {
GoogleAuthProvider,
GithubAuthProvider,
OAuthProvider,
} from 'firebase/auth'
import { useAuth } from '../auth'
import { sleep } from '../utils'
import { siApple, siGithub, siGoogle } from 'simple-icons'
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove unused imports.

Multiple imports are not used in this file: useRouterState, GoogleAuthProvider, OAuthProvider, sleep, siApple, and siGoogle. Consider removing them to keep the code clean.

Apply this diff:

 import {
   createFileRoute,
   redirect,
   useRouter,
-  useRouterState,
 } from '@tanstack/solid-router'
 import { z } from 'zod'
 
 import {
-  GoogleAuthProvider,
   GithubAuthProvider,
-  OAuthProvider,
 } from 'firebase/auth'
 import { useAuth } from '../auth'
-import { sleep } from '../utils'
-import { siApple, siGithub, siGoogle } from 'simple-icons'
+import { siGithub } from 'simple-icons'
📝 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
import {
createFileRoute,
redirect,
useRouter,
useRouterState,
} from '@tanstack/solid-router'
import { z } from 'zod'
import {
GoogleAuthProvider,
GithubAuthProvider,
OAuthProvider,
} from 'firebase/auth'
import { useAuth } from '../auth'
import { sleep } from '../utils'
import { siApple, siGithub, siGoogle } from 'simple-icons'
import {
createFileRoute,
redirect,
useRouter,
} from '@tanstack/solid-router'
import { z } from 'zod'
import {
GithubAuthProvider,
} from 'firebase/auth'
import { useAuth } from '../auth'
import { siGithub } from 'simple-icons'
🧰 Tools
🪛 ESLint

[error] 5-5: 'useRouterState' is defined but never used.

(unused-imports/no-unused-imports)


[error] 10-10: 'GoogleAuthProvider' is defined but never used.

(unused-imports/no-unused-imports)


[error] 11-11: Member 'GithubAuthProvider' of the import declaration should be sorted alphabetically.

(sort-imports)


[error] 12-12: 'OAuthProvider' is defined but never used.

(unused-imports/no-unused-imports)


[error] 15-15: 'sleep' is defined but never used.

(unused-imports/no-unused-imports)


[error] 16-16: simple-icons import should occur before import of ../auth

(import/order)


[error] 16-16: 'siApple' is defined but never used.

(unused-imports/no-unused-imports)


[error] 16-16: 'siGoogle' is defined but never used.

(unused-imports/no-unused-imports)

🤖 Prompt for AI Agents
In examples/solid/authenticated-routes-firebase/src/routes/login.tsx around
lines 1 to 16, several imports are unused; remove useRouterState,
GoogleAuthProvider, OAuthProvider, sleep, siApple, and siGoogle from the top
imports and adjust the import statements so only the actually used symbols
remain (e.g., keep createFileRoute, redirect, useRouter, z, GithubAuthProvider
if used, useAuth, and simple-icons import entries that are referenced
elsewhere); update any trailing commas and formatting accordingly.

Comment on lines +4 to +18
*,
::after,
::before,
::backdrop,
::file-selector-button {
border-color: var(--color-gray-200, currentcolor);
}
}

html {
color-scheme: light dark;
}
* {
@apply border-gray-200 dark:border-gray-800;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Redundant border color definitions.

The border color is defined twice with different approaches:

  1. Lines 4-10: Base layer using an undefined CSS variable --color-gray-200 with a currentcolor fallback
  2. Lines 16-18: Using Tailwind's @apply with border-gray-200 and dark:border-gray-800

The second definition (lines 16-18) will override the first, making the base layer definition redundant. Additionally, the CSS variable --color-gray-200 is referenced but never defined in this file or any visible context.

Consider removing the redundant base layer definition:

-@layer base {
-  *,
-  ::after,
-  ::before,
-  ::backdrop,
-  ::file-selector-button {
-    border-color: var(--color-gray-200, currentcolor);
-  }
-}
-
 html {
   color-scheme: light dark;
 }
📝 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
*,
::after,
::before,
::backdrop,
::file-selector-button {
border-color: var(--color-gray-200, currentcolor);
}
}
html {
color-scheme: light dark;
}
* {
@apply border-gray-200 dark:border-gray-800;
}
html {
color-scheme: light dark;
}
* {
@apply border-gray-200 dark:border-gray-800;
}
🤖 Prompt for AI Agents
In examples/solid/authenticated-routes-firebase/src/styles.css around lines 4 to
18, the file sets border color twice — first via a base rule using an undefined
CSS variable (--color-gray-200) on lines 4–10 and then via Tailwind @apply on
lines 16–18 which overrides it; remove the redundant base-layer border-color
rule (or define the CSS variable if you intend to use it) so only the intended
border styling remains (prefer keeping the Tailwind @apply rules and delete
lines 4–10).

@birkskyum birkskyum merged commit 42f86c2 into main Nov 12, 2025
5 of 6 checks passed
@birkskyum birkskyum deleted the docs(solid-router)-auth-route-firebase branch November 12, 2025 00:21
roduyemi pushed a commit to roduyemi/oss-router that referenced this pull request Nov 19, 2025
* auth-firebase

* docs(solid-router): authenticated-routes-firebase

* add authenticated-routes to example overview

* solid example

* format

* ci: apply automated fixes

* call user function

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
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