TanStackT
TanStack14mo ago
7 replies
full-green

`registerGlobalMiddleware` doesn't seem to work

I created a sample project as per the getting started guide, created a loggingMiddleware as per the documentation, and tried calling registerGlobalMiddleware at various places, e.g. router.tsx, client.tsx, sr.tsx, root.tsx, index.tsx etc., but the middleware wasn't called. However, the middleware works when put in
index.tsx
locally:

const updateCount = createServerFn({ method: 'POST' })
  .middleware([loggingMiddleware])
  .validator((d: number) => d)
Was this page helpful?