@tanstack/react-router 1.2.5 → 1.3.0

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.
@@ -878,6 +878,104 @@ const rootRouteId = '__root__';
878
878
 
879
879
  // The parse type here allows a zod schema to be passed directly to the validator
880
880
 
881
+ // TODO: This is part of a future APi to move away from classes and
882
+ // towards a more functional API. It's not ready yet.
883
+
884
+ // type RouteApiInstance<
885
+ // TId extends RouteIds<RegisteredRouter['routeTree']>,
886
+ // TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,
887
+ // TFullSearchSchema extends Record<
888
+ // string,
889
+ // any
890
+ // > = TRoute['types']['fullSearchSchema'],
891
+ // TAllParams extends AnyPathParams = TRoute['types']['allParams'],
892
+ // TAllContext extends Record<string, any> = TRoute['types']['allContext'],
893
+ // TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'],
894
+ // TLoaderData extends any = TRoute['types']['loaderData'],
895
+ // > = {
896
+ // id: TId
897
+ // useMatch: <TSelected = TAllContext>(opts?: {
898
+ // select?: (s: TAllContext) => TSelected
899
+ // }) => TSelected
900
+
901
+ // useRouteContext: <TSelected = TAllContext>(opts?: {
902
+ // select?: (s: TAllContext) => TSelected
903
+ // }) => TSelected
904
+
905
+ // useSearch: <TSelected = TFullSearchSchema>(opts?: {
906
+ // select?: (s: TFullSearchSchema) => TSelected
907
+ // }) => TSelected
908
+
909
+ // useParams: <TSelected = TAllParams>(opts?: {
910
+ // select?: (s: TAllParams) => TSelected
911
+ // }) => TSelected
912
+
913
+ // useLoaderDeps: <TSelected = TLoaderDeps>(opts?: {
914
+ // select?: (s: TLoaderDeps) => TSelected
915
+ // }) => TSelected
916
+
917
+ // useLoaderData: <TSelected = TLoaderData>(opts?: {
918
+ // select?: (s: TLoaderData) => TSelected
919
+ // }) => TSelected
920
+ // }
921
+
922
+ // export function RouteApi_v2<
923
+ // TId extends RouteIds<RegisteredRouter['routeTree']>,
924
+ // TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,
925
+ // TFullSearchSchema extends Record<
926
+ // string,
927
+ // any
928
+ // > = TRoute['types']['fullSearchSchema'],
929
+ // TAllParams extends AnyPathParams = TRoute['types']['allParams'],
930
+ // TAllContext extends Record<string, any> = TRoute['types']['allContext'],
931
+ // TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'],
932
+ // TLoaderData extends any = TRoute['types']['loaderData'],
933
+ // >({
934
+ // id,
935
+ // }: {
936
+ // id: TId
937
+ // }): RouteApiInstance<
938
+ // TId,
939
+ // TRoute,
940
+ // TFullSearchSchema,
941
+ // TAllParams,
942
+ // TAllContext,
943
+ // TLoaderDeps,
944
+ // TLoaderData
945
+ // > {
946
+ // return {
947
+ // id,
948
+
949
+ // useMatch: (opts) => {
950
+ // return useMatch({ ...opts, from: id })
951
+ // },
952
+
953
+ // useRouteContext: (opts) => {
954
+ // return useMatch({
955
+ // ...opts,
956
+ // from: id,
957
+ // select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),
958
+ // } as any)
959
+ // },
960
+
961
+ // useSearch: (opts) => {
962
+ // return useSearch({ ...opts, from: id } as any)
963
+ // },
964
+
965
+ // useParams: (opts) => {
966
+ // return useParams({ ...opts, from: id } as any)
967
+ // },
968
+
969
+ // useLoaderDeps: (opts) => {
970
+ // return useLoaderDeps({ ...opts, from: id } as any) as any
971
+ // },
972
+
973
+ // useLoaderData: (opts) => {
974
+ // return useLoaderData({ ...opts, from: id } as any) as any
975
+ // },
976
+ // }
977
+ // }
978
+
881
979
  class RouteApi {
882
980
  constructor({
883
981
  id
@@ -1829,11 +1927,11 @@ class Router {
1829
1927
  return false;
1830
1928
  });
1831
1929
  if (foundMask) {
1832
- foundMask = {
1930
+ maskedDest = {
1931
+ ...pick(opts, ['from']),
1833
1932
  ...foundMask,
1834
- from: interpolatePath(foundMask.from, params)
1933
+ params
1835
1934
  };
1836
- maskedDest = foundMask;
1837
1935
  maskedNext = build(maskedDest);
1838
1936
  }
1839
1937
  }