@tanstack/react-router 1.15.4 → 1.15.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.
package/src/Matches.tsx CHANGED
@@ -23,7 +23,13 @@ import {
23
23
  RoutePaths,
24
24
  } from './routeInfo'
25
25
  import { RegisteredRouter, RouterState } from './router'
26
- import { DeepOptional, Expand, NoInfer, StrictOrFrom, pick } from './utils'
26
+ import {
27
+ DeepPartial,
28
+ Expand,
29
+ NoInfer,
30
+ StrictOrFrom,
31
+ pick,
32
+ } from './utils'
27
33
  import {
28
34
  CatchNotFound,
29
35
  DefaultGlobalNotFound,
@@ -293,11 +299,16 @@ export type UseMatchRouteOptions<
293
299
  TTo extends string = '',
294
300
  TMaskFrom extends RoutePaths<TRouteTree> = TFrom,
295
301
  TMaskTo extends string = '',
296
- > = DeepOptional<
297
- ToOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,
298
- 'search' | 'params'
299
- > &
300
- MatchRouteOptions
302
+ Options extends ToOptions<
303
+ TRouteTree,
304
+ TFrom,
305
+ TTo,
306
+ TMaskFrom,
307
+ TMaskTo
308
+ > = ToOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,
309
+ RelaxedOptions = Omit<Options, 'search' | 'params'> &
310
+ DeepPartial<Pick<Options, 'search' | 'params'>>,
311
+ > = RelaxedOptions & MatchRouteOptions
301
312
 
302
313
  export function useMatchRoute<
303
314
  TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
package/src/router.ts CHANGED
@@ -1321,8 +1321,12 @@ export class Router<
1321
1321
  ),
1322
1322
  )
1323
1323
 
1324
+ // wrap loader into an async function to be able to catch synchronous exceptions
1325
+ async function loader() {
1326
+ await route.options.loader?.(loaderContext)
1327
+ }
1324
1328
  // Kick off the loader!
1325
- const loaderPromise = route.options.loader?.(loaderContext)
1329
+ const loaderPromise = loader()
1326
1330
 
1327
1331
  loadPromise = Promise.all([
1328
1332
  componentsPromise,