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

@xmachines/play-tanstack-router

v3.0.0

Published

Shared TanStack Router bridge base for XMachines Play - framework-agnostic logic consumed by the TanStack React/Solid router adapters

Downloads

1,142

Readme

@xmachines/play-tanstack-router

Shared, framework-agnostic TanStack Router bridge base for XMachines Play.

License: MIT Version

TanStack Router gives React and Solid the same navigate, load, and history surface. Therefore the complete bridge implementation lives here, in TanStackRouterBridgeBase. That class extends RouterBridgeBase from @xmachines/play-router. Each framework adapter package makes a subclass of it, and binds its own router type.

This package has no TanStack runtime dependency. TanStackRouterLike is a type-only interface. It describes the small router surface that the bridge uses.

Who consumes it

Usage

import { createMachine } from "xstate";
import { definePlayer, formatPlayRouteTransitions } from "@xmachines/play-xstate";
import { createRouteMap } from "@xmachines/play-router";
import { TanStackRouterBridgeBase } from "@xmachines/play-tanstack-router";

const machine = createMachine(
	formatPlayRouteTransitions({
		id: "app",
		initial: "home",
		states: {
			home: { id: "home", meta: { route: "/" } },
			about: { id: "about", meta: { route: "/about" } },
		},
	}),
);

const actor = definePlayer({ machine })();
actor.start();

const routeMap = createRouteMap(machine);

export class MyTanStackBridge extends TanStackRouterBridgeBase {}

// router: your TanStack Router instance (from the React or Solid createRouter)
const bridge = new MyTanStackBridge(router, actor, routeMap);
bridge.connect();
// Disconnect the bridge at teardown
bridge.disconnect();

Corrective navigation and a mounted <RouterProvider>

The bridge subscribes to router.history, and it calls router.load() for every history event. The bridge waits for that load() promise before it synchronizes the actor. The wait is necessary for a mounted <RouterProvider>: its Transitioner component defers router.updateLatestLocation() into the startTransition of the framework. Without the wait, router.latestLocation still holds the previous href while the bridge runs. A corrective navigation for a refused URL then looks like a navigation to the same URL, and commitLocation of TanStack writes nothing to the browser history. The refused URL then stays in the address bar. With the wait, router.latestLocation is current, and the correction reaches the history. The bridge therefore works with a mounted <RouterProvider> and also without one.

A burst of history events keeps its order: each event takes a sequence number, and a deferred synchronization runs only while its number is still the newest one. A disconnect() call retires every synchronization that still waits.

Exports

  • TanStackRouterBridgeBase — the concrete bridge base class. Use it directly, or make a subclass of it
  • TanStackRouterLike — the TanStack router surface, as a type-only interface
  • TanStackRouteMapLike — the narrow route-map surface that the bridge requires

License

MIT