Sign In

@tanstack/react-router

Package Overview
Dependencies
Maintainers
3
Versions
1195
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.170.31
to
1.170.32
+1
-1
dist/cjs/Transitioner.cjs

@@ -53,3 +53,3 @@ "use client";

});
else if (!router._tx) router.load().catch(console.error);
else if (!router._tx) router.load({ sync: true }).catch(console.error);
return unsub;

@@ -56,0 +56,0 @@ }, [router, router.history]);

@@ -1,1 +0,1 @@

{"version":3,"file":"Transitioner.cjs","names":[],"sources":["../../src/Transitioner.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { getLocationChangeInfo, trimPathRight } from '@tanstack/router-core'\nimport { useLayoutEffect } from './utils'\nimport { useRouter } from './useRouter'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nexport function settleOwner(\n owner: NonNullable<AnyRouter['_rendered']>,\n rendered: boolean,\n) {\n const settle = owner[1 /* settle */]\n owner.length = 0\n settle?.(rendered)\n}\n\nexport function Transitioner({\n t,\n}: {\n t: React.Dispatch<React.SetStateAction<AnyRouter | undefined>>\n}) {\n const router = useRouter()\n const acknowledgement = (router._rendered ??= [])\n const mounted =\n process.env.NODE_ENV !== 'production'\n ? // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useRef(false)\n : undefined\n\n router.startTransition = (fn, expected) =>\n new Promise((resolve) => {\n settleOwner(acknowledgement, false)\n acknowledgement.push(expected, resolve)\n t(router)\n React.startTransition(fn)\n })\n\n // Subscribe before canonicalizing so the initial URL has exactly one load.\n useLayoutEffect(() => {\n const unsub = router.history.subscribe(router.load)\n\n if (mounted?.current) {\n return unsub\n }\n if (mounted) {\n mounted.current = true\n }\n\n router.updateLatestLocation()\n const location = router.latestLocation\n const nextLocation = router.buildLocation({\n to: location.pathname,\n search: true,\n params: true,\n hash: true,\n state: true,\n _includeValidateSearch: true,\n })\n\n // Check if the current URL matches the canonical form.\n // Compare publicHref (browser-facing URL) consistently with server\n // canonicalization.\n if (\n trimPathRight(location.publicHref) !==\n trimPathRight(nextLocation.publicHref)\n ) {\n router.commitLocation({\n ...nextLocation,\n replace: true,\n ignoreBlocker: true,\n })\n return unsub\n }\n\n const resolvedLocation = router.stores.resolvedLocation.get()\n if (\n resolvedLocation?.href === location.href &&\n resolvedLocation.state.__TSR_key === location.state.__TSR_key\n ) {\n acknowledgement.push(router.stores.matches.get(), (rendered) => {\n if (rendered) {\n router.emit({\n type: 'onRendered',\n ...getLocationChangeInfo(resolvedLocation, resolvedLocation),\n })\n }\n })\n } else if (!router._tx) {\n router.load().catch(console.error)\n }\n\n return unsub\n // `mounted` exists only in development and is a stable ref when present.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [router, router.history])\n\n return null\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,YACd,OACA,UACA;CACA,MAAM,SAAS,MAAM;CACrB,MAAM,SAAS;CACf,SAAS,QAAQ;AACnB;AAEA,SAAgB,aAAa,EAC3B,KAGC;CACD,MAAM,SAAS,kBAAA,UAAU;CACzB,MAAM,kBAAmB,OAAO,cAAc,CAAC;CAC/C,MAAM,UAAA,QAAA,IAAA,aACqB,eAErB,MAAM,OAAO,KAAK,IAClB,KAAA;CAEN,OAAO,mBAAmB,IAAI,aAC5B,IAAI,SAAS,YAAY;EACvB,YAAY,iBAAiB,KAAK;EAClC,gBAAgB,KAAK,UAAU,OAAO;EACtC,EAAE,MAAM;EACR,MAAM,gBAAgB,EAAE;CAC1B,CAAC;CAGH,cAAA,sBAAsB;EACpB,MAAM,QAAQ,OAAO,QAAQ,UAAU,OAAO,IAAI;EAElD,IAAI,SAAS,SACX,OAAO;EAET,IAAI,SACF,QAAQ,UAAU;EAGpB,OAAO,qBAAqB;EAC5B,MAAM,WAAW,OAAO;EACxB,MAAM,eAAe,OAAO,cAAc;GACxC,IAAI,SAAS;GACb,QAAQ;GACR,QAAQ;GACR,MAAM;GACN,OAAO;GACP,wBAAwB;EAC1B,CAAC;EAKD,KAAA,GAAA,sBAAA,eACgB,SAAS,UAAU,OAAA,GAAA,sBAAA,eACnB,aAAa,UAAU,GACrC;GACA,OAAO,eAAe;IACpB,GAAG;IACH,SAAS;IACT,eAAe;GACjB,CAAC;GACD,OAAO;EACT;EAEA,MAAM,mBAAmB,OAAO,OAAO,iBAAiB,IAAI;EAC5D,IACE,kBAAkB,SAAS,SAAS,QACpC,iBAAiB,MAAM,cAAc,SAAS,MAAM,WAEpD,gBAAgB,KAAK,OAAO,OAAO,QAAQ,IAAI,IAAI,aAAa;GAC9D,IAAI,UACF,OAAO,KAAK;IACV,MAAM;IACN,IAAA,GAAA,sBAAA,uBAAyB,kBAAkB,gBAAgB;GAC7D,CAAC;EAEL,CAAC;OACI,IAAI,CAAC,OAAO,KACjB,OAAO,KAAK,EAAE,MAAM,QAAQ,KAAK;EAGnC,OAAO;CAGT,GAAG,CAAC,QAAQ,OAAO,OAAO,CAAC;CAE3B,OAAO;AACT"}
{"version":3,"file":"Transitioner.cjs","names":[],"sources":["../../src/Transitioner.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { getLocationChangeInfo, trimPathRight } from '@tanstack/router-core'\nimport { useLayoutEffect } from './utils'\nimport { useRouter } from './useRouter'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nexport function settleOwner(\n owner: NonNullable<AnyRouter['_rendered']>,\n rendered: boolean,\n) {\n const settle = owner[1 /* settle */]\n owner.length = 0\n settle?.(rendered)\n}\n\nexport function Transitioner({\n t,\n}: {\n t: React.Dispatch<React.SetStateAction<AnyRouter | undefined>>\n}) {\n const router = useRouter()\n const acknowledgement = (router._rendered ??= [])\n const mounted =\n process.env.NODE_ENV !== 'production'\n ? // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useRef(false)\n : undefined\n\n router.startTransition = (fn, expected) =>\n new Promise((resolve) => {\n settleOwner(acknowledgement, false)\n acknowledgement.push(expected, resolve)\n t(router)\n React.startTransition(fn)\n })\n\n // Subscribe before canonicalizing so the initial URL has exactly one load.\n useLayoutEffect(() => {\n const unsub = router.history.subscribe(router.load)\n\n if (mounted?.current) {\n return unsub\n }\n if (mounted) {\n mounted.current = true\n }\n\n router.updateLatestLocation()\n const location = router.latestLocation\n const nextLocation = router.buildLocation({\n to: location.pathname,\n search: true,\n params: true,\n hash: true,\n state: true,\n _includeValidateSearch: true,\n })\n\n // Check if the current URL matches the canonical form.\n // Compare publicHref (browser-facing URL) consistently with server\n // canonicalization.\n if (\n trimPathRight(location.publicHref) !==\n trimPathRight(nextLocation.publicHref)\n ) {\n router.commitLocation({\n ...nextLocation,\n replace: true,\n ignoreBlocker: true,\n })\n return unsub\n }\n\n const resolvedLocation = router.stores.resolvedLocation.get()\n if (\n resolvedLocation?.href === location.href &&\n resolvedLocation.state.__TSR_key === location.state.__TSR_key\n ) {\n acknowledgement.push(router.stores.matches.get(), (rendered) => {\n if (rendered) {\n router.emit({\n type: 'onRendered',\n ...getLocationChangeInfo(resolvedLocation, resolvedLocation),\n })\n }\n })\n } else if (!router._tx) {\n router.load({ sync: true }).catch(console.error)\n }\n\n return unsub\n // `mounted` exists only in development and is a stable ref when present.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [router, router.history])\n\n return null\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,YACd,OACA,UACA;CACA,MAAM,SAAS,MAAM;CACrB,MAAM,SAAS;CACf,SAAS,QAAQ;AACnB;AAEA,SAAgB,aAAa,EAC3B,KAGC;CACD,MAAM,SAAS,kBAAA,UAAU;CACzB,MAAM,kBAAmB,OAAO,cAAc,CAAC;CAC/C,MAAM,UAAA,QAAA,IAAA,aACqB,eAErB,MAAM,OAAO,KAAK,IAClB,KAAA;CAEN,OAAO,mBAAmB,IAAI,aAC5B,IAAI,SAAS,YAAY;EACvB,YAAY,iBAAiB,KAAK;EAClC,gBAAgB,KAAK,UAAU,OAAO;EACtC,EAAE,MAAM;EACR,MAAM,gBAAgB,EAAE;CAC1B,CAAC;CAGH,cAAA,sBAAsB;EACpB,MAAM,QAAQ,OAAO,QAAQ,UAAU,OAAO,IAAI;EAElD,IAAI,SAAS,SACX,OAAO;EAET,IAAI,SACF,QAAQ,UAAU;EAGpB,OAAO,qBAAqB;EAC5B,MAAM,WAAW,OAAO;EACxB,MAAM,eAAe,OAAO,cAAc;GACxC,IAAI,SAAS;GACb,QAAQ;GACR,QAAQ;GACR,MAAM;GACN,OAAO;GACP,wBAAwB;EAC1B,CAAC;EAKD,KAAA,GAAA,sBAAA,eACgB,SAAS,UAAU,OAAA,GAAA,sBAAA,eACnB,aAAa,UAAU,GACrC;GACA,OAAO,eAAe;IACpB,GAAG;IACH,SAAS;IACT,eAAe;GACjB,CAAC;GACD,OAAO;EACT;EAEA,MAAM,mBAAmB,OAAO,OAAO,iBAAiB,IAAI;EAC5D,IACE,kBAAkB,SAAS,SAAS,QACpC,iBAAiB,MAAM,cAAc,SAAS,MAAM,WAEpD,gBAAgB,KAAK,OAAO,OAAO,QAAQ,IAAI,IAAI,aAAa;GAC9D,IAAI,UACF,OAAO,KAAK;IACV,MAAM;IACN,IAAA,GAAA,sBAAA,uBAAyB,kBAAkB,gBAAgB;GAC7D,CAAC;EAEL,CAAC;OACI,IAAI,CAAC,OAAO,KACjB,OAAO,KAAK,EAAE,MAAM,KAAK,CAAC,EAAE,MAAM,QAAQ,KAAK;EAGjD,OAAO;CAGT,GAAG,CAAC,QAAQ,OAAO,OAAO,CAAC;CAE3B,OAAO;AACT"}

@@ -51,3 +51,3 @@ "use client";

});
else if (!router._tx) router.load().catch(console.error);
else if (!router._tx) router.load({ sync: true }).catch(console.error);
return unsub;

@@ -54,0 +54,0 @@ }, [router, router.history]);

@@ -1,1 +0,1 @@

{"version":3,"file":"Transitioner.js","names":[],"sources":["../../src/Transitioner.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { getLocationChangeInfo, trimPathRight } from '@tanstack/router-core'\nimport { useLayoutEffect } from './utils'\nimport { useRouter } from './useRouter'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nexport function settleOwner(\n owner: NonNullable<AnyRouter['_rendered']>,\n rendered: boolean,\n) {\n const settle = owner[1 /* settle */]\n owner.length = 0\n settle?.(rendered)\n}\n\nexport function Transitioner({\n t,\n}: {\n t: React.Dispatch<React.SetStateAction<AnyRouter | undefined>>\n}) {\n const router = useRouter()\n const acknowledgement = (router._rendered ??= [])\n const mounted =\n process.env.NODE_ENV !== 'production'\n ? // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useRef(false)\n : undefined\n\n router.startTransition = (fn, expected) =>\n new Promise((resolve) => {\n settleOwner(acknowledgement, false)\n acknowledgement.push(expected, resolve)\n t(router)\n React.startTransition(fn)\n })\n\n // Subscribe before canonicalizing so the initial URL has exactly one load.\n useLayoutEffect(() => {\n const unsub = router.history.subscribe(router.load)\n\n if (mounted?.current) {\n return unsub\n }\n if (mounted) {\n mounted.current = true\n }\n\n router.updateLatestLocation()\n const location = router.latestLocation\n const nextLocation = router.buildLocation({\n to: location.pathname,\n search: true,\n params: true,\n hash: true,\n state: true,\n _includeValidateSearch: true,\n })\n\n // Check if the current URL matches the canonical form.\n // Compare publicHref (browser-facing URL) consistently with server\n // canonicalization.\n if (\n trimPathRight(location.publicHref) !==\n trimPathRight(nextLocation.publicHref)\n ) {\n router.commitLocation({\n ...nextLocation,\n replace: true,\n ignoreBlocker: true,\n })\n return unsub\n }\n\n const resolvedLocation = router.stores.resolvedLocation.get()\n if (\n resolvedLocation?.href === location.href &&\n resolvedLocation.state.__TSR_key === location.state.__TSR_key\n ) {\n acknowledgement.push(router.stores.matches.get(), (rendered) => {\n if (rendered) {\n router.emit({\n type: 'onRendered',\n ...getLocationChangeInfo(resolvedLocation, resolvedLocation),\n })\n }\n })\n } else if (!router._tx) {\n router.load().catch(console.error)\n }\n\n return unsub\n // `mounted` exists only in development and is a stable ref when present.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [router, router.history])\n\n return null\n}\n"],"mappings":";;;;;;A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AQ,OAAO,OAAO,CAAC;CAE3B,OAAO;AACT"}
{"version":3,"file":"Transitioner.js","names":[],"sources":["../../src/Transitioner.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { getLocationChangeInfo, trimPathRight } from '@tanstack/router-core'\nimport { useLayoutEffect } from './utils'\nimport { useRouter } from './useRouter'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nexport function settleOwner(\n owner: NonNullable<AnyRouter['_rendered']>,\n rendered: boolean,\n) {\n const settle = owner[1 /* settle */]\n owner.length = 0\n settle?.(rendered)\n}\n\nexport function Transitioner({\n t,\n}: {\n t: React.Dispatch<React.SetStateAction<AnyRouter | undefined>>\n}) {\n const router = useRouter()\n const acknowledgement = (router._rendered ??= [])\n const mounted =\n process.env.NODE_ENV !== 'production'\n ? // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useRef(false)\n : undefined\n\n router.startTransition = (fn, expected) =>\n new Promise((resolve) => {\n settleOwner(acknowledgement, false)\n acknowledgement.push(expected, resolve)\n t(router)\n React.startTransition(fn)\n })\n\n // Subscribe before canonicalizing so the initial URL has exactly one load.\n useLayoutEffect(() => {\n const unsub = router.history.subscribe(router.load)\n\n if (mounted?.current) {\n return unsub\n }\n if (mounted) {\n mounted.current = true\n }\n\n router.updateLatestLocation()\n const location = router.latestLocation\n const nextLocation = router.buildLocation({\n to: location.pathname,\n search: true,\n params: true,\n hash: true,\n state: true,\n _includeValidateSearch: true,\n })\n\n // Check if the current URL matches the canonical form.\n // Compare publicHref (browser-facing URL) consistently with server\n // canonicalization.\n if (\n trimPathRight(location.publicHref) !==\n trimPathRight(nextLocation.publicHref)\n ) {\n router.commitLocation({\n ...nextLocation,\n replace: true,\n ignoreBlocker: true,\n })\n return unsub\n }\n\n const resolvedLocation = router.stores.resolvedLocation.get()\n if (\n resolvedLocation?.href === location.href &&\n resolvedLocation.state.__TSR_key === location.state.__TSR_key\n ) {\n acknowledgement.push(router.stores.matches.get(), (rendered) => {\n if (rendered) {\n router.emit({\n type: 'onRendered',\n ...getLocationChangeInfo(resolvedLocation, resolvedLocation),\n })\n }\n })\n } else if (!router._tx) {\n router.load({ sync: true }).catch(console.error)\n }\n\n return unsub\n // `mounted` exists only in development and is a stable ref when present.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [router, router.history])\n\n return null\n}\n"],"mappings":";;;;;;AAQA,SAAgB,YACd,OACA,UACA;CACA,MAAM,SAAS,MAAM;CACrB,MAAM,SAAS;CACf,SAAS,QAAQ;AACnB;AAEA,SAAgB,aAAa,EAC3B,KAGC;CACD,MAAM,SAAS,UAAU;CACzB,MAAM,kBAAmB,OAAO,cAAc,CAAC;CAC/C,MAAM,UAAA,QAAA,IAAA,aACqB,eAErB,QAAM,OAAO,KAAK,IAClB,KAAA;CAEN,OAAO,mBAAmB,IAAI,aAC5B,IAAI,SAAS,YAAY;EACvB,YAAY,iBAAiB,KAAK;EAClC,gBAAgB,KAAK,UAAU,OAAO;EACtC,EAAE,MAAM;EACR,QAAM,gBAAgB,EAAE;CAC1B,CAAC;CAGH,sBAAsB;EACpB,MAAM,QAAQ,OAAO,QAAQ,UAAU,OAAO,IAAI;EAElD,IAAI,SAAS,SACX,OAAO;EAET,IAAI,SACF,QAAQ,UAAU;EAGpB,OAAO,qBAAqB;EAC5B,MAAM,WAAW,OAAO;EACxB,MAAM,eAAe,OAAO,cAAc;GACxC,IAAI,SAAS;GACb,QAAQ;GACR,QAAQ;GACR,MAAM;GACN,OAAO;GACP,wBAAwB;EAC1B,CAAC;EAKD,IACE,cAAc,SAAS,UAAU,MACjC,cAAc,aAAa,UAAU,GACrC;GACA,OAAO,eAAe;IACpB,GAAG;IACH,SAAS;IACT,eAAe;GACjB,CAAC;GACD,OAAO;EACT;EAEA,MAAM,mBAAmB,OAAO,OAAO,iBAAiB,IAAI;EAC5D,IACE,kBAAkB,SAAS,SAAS,QACpC,iBAAiB,MAAM,cAAc,SAAS,MAAM,WAEpD,gBAAgB,KAAK,OAAO,OAAO,QAAQ,IAAI,IAAI,aAAa;GAC9D,IAAI,UACF,OAAO,KAAK;IACV,MAAM;IACN,GAAG,sBAAsB,kBAAkB,gBAAgB;GAC7D,CAAC;EAEL,CAAC;OACI,IAAI,CAAC,OAAO,KACjB,OAAO,KAAK,EAAE,MAAM,KAAK,CAAC,EAAE,MAAM,QAAQ,KAAK;EAGjD,OAAO;CAGT,GAAG,CAAC,QAAQ,OAAO,OAAO,CAAC;CAE3B,OAAO;AACT"}
{
"name": "@tanstack/react-router",
"version": "1.170.31",
"version": "1.170.32",
"description": "Modern and scalable routing for React applications",

@@ -81,3 +81,3 @@ "author": "Tanner Linsley",

"@tanstack/history": "1.162.1",
"@tanstack/router-core": "1.171.26"
"@tanstack/router-core": "1.171.27"
},

@@ -84,0 +84,0 @@ "devDependencies": {

@@ -90,3 +90,3 @@ 'use client'

} else if (!router._tx) {
router.load().catch(console.error)
router.load({ sync: true }).catch(console.error)
}

@@ -93,0 +93,0 @@