npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tanstack-table-route

v0.2.1

Published

An opinionated library that leverages TanStack Router, TanStack Query, and TanStack Table to take care of the routing, loading, and caching infrastructure for a filtered, sorted, and paginated table of data served by an API of your choice and shown in a R

Readme

tanstack-table-route

An opinionated library that leverages TanStack Router, TanStack Query, and TanStack Table to take care of the routing, loading, and caching infrastructure for a filtered, sorted, and paginated table of data served by an API of your choice and shown in a React table component of your choice.

Installation

To use this library in your project, install the npm package 'tanstack-table-route':

pnpm add tanstack-table-route
yarn add tanstack-table-route
npm install tanstack-table-route

Usage

This library provides the fspRouteOptions function. This function returns an options object that can be passed to the createRoute function for code-based routing or the createFileRoute for file-based routing. Both functions should be called with an options object. Some of these options are required and some are optional.

Code-Based FSP Routing

To specify a code-based FSP table route, you need to use the fspRouteOptions function in conjunction with the createRoute function as shown in the following example:

import { createRoute } from '@tanstack/react-router'
import { fspRouteOptions } from 'tanstack-table-route'

const tasksIndexRoute = createRoute({
  getParentRoute: () => rootRoute,
  path: '/items',
  ...fspRouteOptions({
    component: Items,
    queryURLBuilder: (params: FSPParams) => drfQueryURLBuilder(API_BASE_URL, params),
  }),
})

File-Based FSP Routing

To specify a file-based FSP table route, you need to use the fspRouteOptions function in conjunction with the createFileRoute function as shown in the following example:

import { createFileRoute } from '@tanstack/react-router'
import { fspRouteOptions } from 'tanstack-table-route'

export const Route = createFileRoute(path)(
  fspRouteOptions({
    component: Items,
    queryURLBuilder: (params: FSPParams) => drfQueryURLBuilder(API_BASE_URL, params),
    parseData: function (rawTask: RawTaskData): TaskData {
      const { created_at, completed_at, ...restData } = rawTask
      return {
        created_at: new Date(created_at),
        completed_at: completed_at ? new Date(completed_at) : null,
        ...restData,
      }
    },
  })
)

Options

The options provided to the fspRouteOptions function are:

  • component: The React component that renders the filtered, sorted, and paginated table. This component receives the props specified in FSPComponentProps. This component is wrapped in a component that provides the necessary context for the table to work, i.e., it takes care of querying the appropriate page of data based on the filtering, sorting, and pagination parameters. The wrapping component is included in the underlying TanStack Router options.
  • queryURLBuilder: A function that builds the API URL from which to fetch the filtered and sorted page of items as specified in the given query parameters and based on the given base URL.
  • parseData: Optional function that parses a raw data object as fetched from the API server and returns a data object with properties of the desired types. These parsed data objects are provided to the table component (and cached by TanStack Query).
  • errorComponent: Optional React component that renders when an error occurs. A default is provided. Included in the underlying TanStack Router options.
  • pendingComponent: Optional React component that renders while the route is loading. A default is provided. Included in the underlying TanStack Router options.

Enabling Auto-CodeSplitting in the TanStack Router Vite Plugin

If you want to enable the autoCodeSplitting option in the TanStack Router plugin for Vite, you will also need to adjust your use of the fspRouteOption helper due to limitations in this plugin.

The plugin uses static analysis to identify the chunking targets. To be able to do so, it needs the options for the createFileRoute function to be explicitly expressed in the code. To achieve this, you must destructure the results of the fspRouteOption helper and provide them as key-value options to the createFileRoute function, as shown in the following rewritten example.

const {
  component,
  loader,
  loaderDeps,
  pendingComponent,
  errorComponent,
  validateSearch,
} = fspRouteOptions({
  component: Tasks,
  queryURLBuilder: (params: FSPParams) => drfQueryURLBuilder(API_BASE_URL, params),
})
export const Route = createFileRoute('/tasks/')({
  component,
  loader,
  loaderDeps,
  pendingComponent,
  errorComponent,
  validateSearch,
})

Examples

The sourcecode for this project is maintained in a monorepo that also contains two fully functioning demo applications with a Mantine-based frontend and a DRF-based API backend.