Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@tanstack/react-router

Package Overview
Dependencies
Maintainers
2
Versions
620
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/react-router - npm Package Compare versions

Comparing version 1.69.1 to 1.70.0

1

dist/esm/Matches.d.ts

@@ -47,3 +47,2 @@ import { AnyRoute, ReactNode, StaticDataRouteOption } from './route.js';

updatedAt: number;
componentsPromise?: Promise<Array<void>>;
loadPromise?: ControlledPromise<void>;

@@ -50,0 +49,0 @@ beforeLoadPromise?: ControlledPromise<void>;

1

dist/esm/route.d.ts

@@ -324,2 +324,3 @@ import { RootRouteId } from './root.js';

_lazyPromise?: Promise<void>;
_componentsPromise?: Promise<Array<void>>;
/**

@@ -326,0 +327,0 @@ * @deprecated Use the `createRoute` function instead.

@@ -342,6 +342,15 @@ import { Store, NoInfer } from '@tanstack/react-store';

* @default typeof document !== 'undefined'
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#isserver property)
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#isserver-property)
*/
isServer?: boolean;
defaultSsr?: boolean;
search?: {
/**
* Configures how unknown search params (= not returned by any `validateSearch`) are treated.
*
* @default false
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#search.strict-property)
*/
strict?: boolean;
};
}

@@ -514,3 +523,5 @@ export interface RouterErrorSerializer<TSerializedError> {

}) => Promise<Array<MakeRouteMatch>>;
invalidate: () => Promise<void>;
invalidate: (opts?: {
filter?: (d: MakeRouteMatch<TRouteTree>) => boolean;
}) => Promise<void>;
resolveRedirect: (err: AnyRedirect) => ResolvedRedirect;

@@ -517,0 +528,0 @@ cleanCache: () => void;

@@ -273,3 +273,3 @@ import { createMemoryHistory, createBrowserHistory, parseHref } from "@tanstack/history";

const build = (dest = {}, matchedRoutesResult) => {
var _a, _b, _c, _d, _e;
var _a, _b, _c, _d, _e, _f;
const fromMatches = dest._fromLocation ? this.matchRoutes(dest._fromLocation, { _buildLocation: true }) : this.state.matches;

@@ -385,2 +385,3 @@ const fromMatch = dest.from != null ? fromMatches.find(

if (opts._includeValidateSearch) {
let validatedSearch = ((_f = this.options.search) == null ? void 0 : _f.strict) ? {} : search;
matchedRoutesResult == null ? void 0 : matchedRoutesResult.matchedRoutes.forEach((route) => {

@@ -390,3 +391,6 @@ try {

const validator = typeof route.options.validateSearch === "object" ? route.options.validateSearch.parse : route.options.validateSearch;
search = { ...search, ...validator(search) };
validatedSearch = {
...validatedSearch,
...validator({ ...validatedSearch, ...search })
};
}

@@ -396,2 +400,3 @@ } catch (e) {

});
search = validatedSearch;
}

@@ -964,20 +969,27 @@ search = replaceEqualDeep(fromSearch, search);

try {
route._lazyPromise = route._lazyPromise || (route.lazyFn ? route.lazyFn().then((lazyRoute) => {
const { id, ...options2 } = lazyRoute.options;
Object.assign(route.options, options2);
}) : Promise.resolve());
const componentsPromise = this.getMatch(matchId).componentsPromise || route._lazyPromise.then(
() => Promise.all(
componentTypes.map(async (type) => {
const component = route.options[type];
if (component == null ? void 0 : component.preload) {
await component.preload();
}
})
)
);
if (route._lazyPromise === void 0) {
if (route.lazyFn) {
route._lazyPromise = route.lazyFn().then((lazyRoute) => {
const { id: _id, ...options2 } = lazyRoute.options;
Object.assign(route.options, options2);
});
} else {
route._lazyPromise = Promise.resolve();
}
}
if (route._componentsPromise === void 0) {
route._componentsPromise = route._lazyPromise.then(
() => Promise.all(
componentTypes.map(async (type) => {
const component = route.options[type];
if (component == null ? void 0 : component.preload) {
await component.preload();
}
})
)
);
}
updateMatch(matchId, (prev) => ({
...prev,
isFetching: "loader",
componentsPromise
isFetching: "loader"
}));

@@ -1040,3 +1052,3 @@ let loaderData = await ((_b2 = (_a2 = route.options).loader) == null ? void 0 : _b2.call(_a2, getLoaderContext()));

}
await this.getMatch(matchId).componentsPromise;
await route._componentsPromise;
} catch (err) {

@@ -1091,8 +1103,14 @@ handleRedirectAndNotFound(this.getMatch(matchId), err);

};
this.invalidate = () => {
const invalidate = (d) => ({
...d,
invalid: true,
...d.status === "error" ? { status: "pending", error: void 0 } : {}
});
this.invalidate = (opts) => {
const invalidate = (d) => {
var _a;
if (((_a = opts == null ? void 0 : opts.filter) == null ? void 0 : _a.call(opts, d)) ?? true) {
return {
...d,
invalid: true,
...d.status === "error" ? { status: "pending", error: void 0 } : {}
};
}
return d;
};
this.__store.setState((s) => {

@@ -1099,0 +1117,0 @@ var _a;

@@ -29,3 +29,4 @@ import * as React from "react";

hash: true,
state: true
state: true,
_includeValidateSearch: true
});

@@ -32,0 +33,0 @@ if (trimPathRight(router.latestLocation.href) !== trimPathRight(nextLocation.href)) {

{
"name": "@tanstack/react-router",
"version": "1.69.1",
"version": "1.70.0",
"description": "Modern and scalable routing for React applications",

@@ -5,0 +5,0 @@ "author": "Tanner Linsley",

@@ -948,2 +948,3 @@ import invariant from 'tiny-invariant'

_lazyPromise?: Promise<void>
_componentsPromise?: Promise<Array<void>>

@@ -950,0 +951,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc