Subscribe to router’s global blocking state
Is there a way to subscribe to TanStack Router’s global blocking state?
Use-case
Root-level component that should pop up whenever any navigation is blocked anywhere in the app. Something like:
From the docs, useBlocker() seems scoped to its consuming route. What I’d like instead is a hook/event that tells a top-level component: “the router is blocking right now.”
Couldn’t find any 'blocking' property or similar state in the router history or internals
Seems like the history object only holds a 'block' method, but doesnt holds the blocking state
https://github.com/TanStack/router/blob/192ee6246cdbd3a38e2fd8969a7522bbda64c0d3/packages/history/src/index.ts#L35C1-L36C1
Does such a hook exist, or any recommended way to listen to this state?
Thanks!