@tanstack/router-devtools 1.5.4 → 1.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -300,15 +300,7 @@
300
300
  *
301
301
  * @license MIT
302
302
  */
303
- function isFunction(d) {
304
- return typeof d === 'function';
305
- }
306
- function functionalUpdate(updater, previous) {
307
- if (isFunction(updater)) {
308
- return updater(previous);
309
- }
310
- return updater;
311
- }
303
+
312
304
  let routerContext = /*#__PURE__*/React__namespace.createContext(null);
313
305
  if (typeof document !== 'undefined') {
314
306
  if (window.__TSR_ROUTER_CONTEXT__) {
@@ -317,17 +309,28 @@
317
309
  window.__TSR_ROUTER_CONTEXT__ = routerContext;
318
310
  }
319
311
  }
312
+
313
+ function useRouter(opts) {
314
+ const resolvedContext = typeof document !== 'undefined' ? window.__TSR_ROUTER_CONTEXT__ || routerContext : routerContext;
315
+ const value = React__namespace.useContext(resolvedContext);
316
+ warning(!((opts?.warn ?? true) && !value), 'useRouter must be used inside a <RouterProvider> component!');
317
+ return value;
318
+ }
319
+
320
320
  function useRouterState(opts) {
321
321
  const contextRouter = useRouter({
322
322
  warn: opts?.router === undefined
323
323
  });
324
324
  return useStore((opts?.router || contextRouter).__store, opts?.select);
325
325
  }
326
- function useRouter(opts) {
327
- const resolvedContext = typeof document !== 'undefined' ? window.__TSR_ROUTER_CONTEXT__ || routerContext : routerContext;
328
- const value = React__namespace.useContext(resolvedContext);
329
- warning(!((opts?.warn ?? true) && !value), 'useRouter must be used inside a <RouterProvider> component!');
330
- return value;
326
+ function isFunction(d) {
327
+ return typeof d === 'function';
328
+ }
329
+ function functionalUpdate(updater, previous) {
330
+ if (isFunction(updater)) {
331
+ return updater(previous);
332
+ }
333
+ return updater;
331
334
  }
332
335
  function trimPathLeft(path) {
333
336
  return path === '/' ? path : path.replace(/^\/{1,}/, '');