GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - kurochenko/tanstack-start-breadcrumbs-example: Example project showcasing breadcrumbs in Tanstack Start with SSR and dynamic update of breadcrumbs on data change.

BranchesTags
Open more actions menu

Latest commit

 

History

5 Commits
5 Commits

Folders and files

NameName
Last commit message
Last commit date
public
public
 
 
src
src
 
 
.gitignore
.gitignore
 
 
.prettierignore
.prettierignore
 
 
README.md
README.md
 
 
bun.lock
bun.lock
 
 
eslint.config.js
eslint.config.js
 
 
netlify.toml
netlify.toml
 
 
package.json
package.json
 
 
prettier.config.js
prettier.config.js
 
 
tsconfig.json
tsconfig.json
 
 
vite.config.ts
vite.config.ts
 
 

Repository files navigation

TanStack Start Breadcrumbs Demo

A demonstration of how to implement dynamic breadcrumbs in TanStack Start that automatically update after mutations using router.invalidate().

🌐 Live Demo → | Deployed on Netlify with SSR support via Edge Functions

Features

  • Server-Side Rendering: Organizations and employees are loaded via server functions
  • Dynamic Breadcrumbs: Breadcrumbs are prerendered on the server and update reactively on the client
  • Real-time Updates: Edit organization/employee names and watch the breadcrumbs update instantly
  • File-based Routing: Uses TanStack Router's file-based routing system

Getting Started

Prerequisites

  • Node.js 18+
  • Bun (recommended) or npm

Installation

# Clone the repository
git clone <repository-url>
cd tanstack-start-router-breadcrumbs-example

# Install dependencies
bun install

Running the Development Server

# Start the dev server
bun dev

The application will be available at http://localhost:3000

How It Works

1. Route Loaders with Crumbs

Each route defines a crumb property in its loader:

export const Route = createFileRoute('/organizations/$orgId')({
  loader: async ({ params }) => {
    const organization = await getOrganization({ data: { id: params.orgId } })
    return {
      crumb: organization.name, // Dynamic breadcrumb!
      organization,
    }
  },
})

2. BreadcrumbNav Component

The breadcrumb component uses useMatches() to reactively display all matched routes:

const BreadcrumbNav = () => {
  const matches = useMatches()
  const matchesWithCrumbs = matches.filter((match) =>
    isMatch(match, 'loaderData.crumb'),
  )
  // Renders breadcrumbs from loader data
}

3. Mutation + Invalidation

After mutations, call router.invalidate() to re-run loaders:

const handleUpdateName = async () => {
  await updateOrganization({ data: { id: orgId, name: newName } })
  await router.invalidate() // This updates the breadcrumbs!
}

Demo Flow

  1. Home → Landing page explaining the demo
  2. Breadcrumbs Demo → Intro page
  3. Organizations → List of organizations
  4. Organization Details → View/edit organization name (watch breadcrumbs update!)
  5. Employees → List of employees for the organization
  6. Employee Details → View/edit employee name (watch breadcrumbs update!)

Key Technologies

  • TanStack Start: Full-stack React framework with server functions
  • TanStack Router: Type-safe routing with file-based routing
  • Server Functions: Run code on the server from client components
  • SSR: Server-side rendering for fast initial page loads
  • Tailwind CSS: Utility-first CSS framework

Project Structure

src/
ā”œā”€ā”€ components/
│   ā”œā”€ā”€ BreadcrumbNav.tsx    # Breadcrumb navigation component
│   └── Header.tsx           # Application header
ā”œā”€ā”€ data/
│   └── organizations.ts     # Server functions for CRUD operations
ā”œā”€ā”€ routes/
│   ā”œā”€ā”€ __root.tsx           # Root layout with SSR setup
│   ā”œā”€ā”€ index.tsx            # Landing page
│   └── demo/
│       └── breadcrumbs/
│           ā”œā”€ā”€ route.tsx                    # Layout with BreadcrumbNav
│           ā”œā”€ā”€ index.tsx                    # Demo intro
│           └── organizations/
│               ā”œā”€ā”€ index.tsx                # Organizations list
│               └── $orgId/
│                   ā”œā”€ā”€ route.tsx            # Organization loader
│                   ā”œā”€ā”€ index.tsx            # Organization details
│                   └── employees/
│                       ā”œā”€ā”€ index.tsx        # Employees list
│                       └── $employeeId.tsx  # Employee details

About

Example project showcasing breadcrumbs in Tanstack Start with SSR and dynamic update of breadcrumbs on data change.

Resources

Readme
Activity

Stars

23 stars

Watchers

0 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Ɨ600. No cookies required.