CodeVetter · Repo Unpack · Extension points
TanStack/router
Extension is concentrated in route options, framework factories, generator hooks, middleware, and transport adapters. These hooks allow application behavior without moving request state into shared metadata. Build integration is split between generator configuration and bundler lifecycle hooks. SSR extensions must preserve the existing cleanup and serialization ownership contracts.
- Framework integration plugs into RouterCore through the constructor's GetStoreConfig argument; the React factory chooses mutable/readonly implementations and batching by runtime.
- Route hooks extend the loading pipeline through context, beforeLoad, and loader; beforeLoad receives params, search, navigation helpers, abortController, cause, and additionalContext.
- Applications can replace search serialization through parseSearch/stringifySearch options or the parseSearchWith/stringifySearchWith factories.
- React presentation extends through RouterOptionsExtensions defaults, Wrap/InnerWrap, and RouterContextProvider's merged runtime context/options.
- GeneratorPlugin provides named init, afterTransform, and onRouteTreeChanged hooks with generator or route-node/tree information.
- createRouterGeneratorPlugin accepts configuration or a configuration factory, supports disabling generation, and connects Vite configResolved plus bundler watch events to Generator.run.
- Start combines application and plugin serialization adapters, exposes global request middleware, and allows route-method middleware plus handler functions or handler objects.
- SSR integrates through createStartHandler's callback/options form and Router dehydrate/lifecycle hooks; Query integration chains existing dehydration and registers cleanup immediately when server SSR attaches.