reroute-js 0.43.0 → 0.43.2
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/cli/bin.d.ts +1 -1
- package/cli/bin.js +19 -27
- package/cli/bin.js.map +4 -4
- package/cli/index.d.ts +1 -1
- package/cli/index.js +4 -4
- package/cli/index.js.map +1 -1
- package/cli/src/cli.d.ts +1 -1
- package/cli/src/commands/analyze.d.ts +1 -1
- package/cli/src/commands/build.d.ts +1 -1
- package/cli/src/commands/dev.d.ts +1 -1
- package/cli/src/commands/gen.d.ts +1 -1
- package/cli/src/commands/gen.d.ts.map +1 -1
- package/cli/src/commands/index.d.ts +1 -1
- package/cli/src/commands/init.d.ts +1 -1
- package/cli/src/commands/lib/assets.d.ts +1 -1
- package/cli/src/commands/lib/bundler.d.ts +1 -1
- package/cli/src/commands/lib/command.d.ts +1 -1
- package/cli/src/commands/lib/env.d.ts +1 -1
- package/cli/src/commands/lib/index.d.ts +1 -1
- package/cli/src/commands/lib/log.d.ts +1 -1
- package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
- package/cli/src/commands/lib/markdown/index.d.ts +1 -1
- package/cli/src/commands/lib/markdown/processor.d.ts +1 -1
- package/cli/src/commands/lib/production.d.ts +1 -1
- package/cli/src/commands/lib/server.d.ts +1 -1
- package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
- package/cli/src/commands/lib/streaming/suspense.d.ts +1 -1
- package/cli/src/commands/lib/streaming/suspense.d.ts.map +1 -1
- package/cli/src/commands/lib/tailwind.d.ts +1 -1
- package/cli/src/commands/lib/terminal-ui.d.ts +1 -1
- package/cli/src/commands/lib/version.d.ts +1 -1
- package/cli/src/commands/og.d.ts +1 -1
- package/cli/src/commands/start.d.ts +1 -1
- package/cli/src/index.d.ts +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +2 -2
- package/core/index.js.map +1 -1
- package/core/src/bundler/hash.d.ts +1 -1
- package/core/src/bundler/index.d.ts +1 -1
- package/core/src/config.d.ts +1 -1
- package/core/src/content/discovery.d.ts +1 -1
- package/core/src/content/index.d.ts +1 -1
- package/core/src/content/metadata.d.ts +1 -1
- package/core/src/index.d.ts +1 -1
- package/core/src/llms/extractor.d.ts +1 -1
- package/core/src/llms/formatter.d.ts +1 -1
- package/core/src/llms/full-generator.d.ts +1 -1
- package/core/src/llms/index-generator.d.ts +1 -1
- package/core/src/llms/index.d.ts +1 -1
- package/core/src/og/discovery.d.ts +1 -1
- package/core/src/og/index.d.ts +1 -1
- package/core/src/og/meta.d.ts +1 -1
- package/core/src/og/render.d.ts +1 -1
- package/core/src/og/types.d.ts +1 -1
- package/core/src/robots/discovery.d.ts +1 -1
- package/core/src/robots/generator.d.ts +1 -1
- package/core/src/robots/index.d.ts +1 -1
- package/core/src/robots/policies.d.ts +1 -1
- package/core/src/rss/discovery.d.ts +1 -1
- package/core/src/rss/generator.d.ts +1 -1
- package/core/src/rss/index.d.ts +1 -1
- package/core/src/sitemap/discovery.d.ts +1 -1
- package/core/src/sitemap/generator.d.ts +1 -1
- package/core/src/sitemap/index.d.ts +1 -1
- package/core/src/ssr/index.d.ts +1 -1
- package/core/src/ssr/lib/cache.d.ts +1 -1
- package/core/src/ssr/lib/collections.d.ts +1 -1
- package/core/src/ssr/lib/compression.d.ts +1 -1
- package/core/src/ssr/lib/compute/content.d.ts +1 -1
- package/core/src/ssr/lib/compute/index.d.ts +1 -1
- package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
- package/core/src/ssr/lib/compute/routes.d.ts +1 -1
- package/core/src/ssr/lib/data.d.ts +1 -1
- package/core/src/ssr/lib/html.d.ts +1 -1
- package/core/src/ssr/lib/imports.d.ts +1 -1
- package/core/src/ssr/lib/index.d.ts +1 -1
- package/core/src/ssr/lib/layouts.d.ts +1 -1
- package/core/src/ssr/lib/metadata.d.ts +1 -1
- package/core/src/ssr/lib/mime.d.ts +1 -1
- package/core/src/ssr/lib/modules.d.ts +1 -1
- package/core/src/ssr/lib/path.d.ts +1 -1
- package/core/src/ssr/lib/preload.d.ts +1 -1
- package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
- package/core/src/ssr/lib/scripts/data.d.ts +1 -1
- package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
- package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
- package/core/src/ssr/lib/scripts/index.d.ts +1 -1
- package/core/src/ssr/lib/seed.d.ts +1 -1
- package/core/src/ssr/lib/serialize.d.ts +1 -1
- package/core/src/ssr/lib/setup.d.ts +1 -1
- package/core/src/ssr/lib/styles.d.ts +1 -1
- package/core/src/ssr/lib/template.d.ts +1 -1
- package/core/src/ssr/lib/types.d.ts +1 -1
- package/core/src/ssr/render.d.ts +1 -1
- package/core/src/ssr/stream.d.ts +1 -1
- package/elysia/index.d.ts +1 -1
- package/elysia/index.js +63 -31
- package/elysia/index.js.map +5 -5
- package/elysia/src/index.d.ts +1 -1
- package/elysia/src/libs/assets.d.ts +1 -1
- package/elysia/src/libs/cache.d.ts +1 -1
- package/elysia/src/libs/caching.d.ts +1 -1
- package/elysia/src/libs/http.d.ts +1 -1
- package/elysia/src/libs/image.d.ts +1 -1
- package/elysia/src/libs/index.d.ts +1 -1
- package/elysia/src/libs/llms.d.ts +1 -1
- package/elysia/src/libs/response.d.ts +1 -1
- package/elysia/src/libs/serving.d.ts +1 -1
- package/elysia/src/plugin.d.ts +1 -1
- package/elysia/src/routes/artifacts.d.ts +1 -1
- package/elysia/src/routes/artifacts.d.ts.map +1 -1
- package/elysia/src/routes/content.d.ts +1 -1
- package/elysia/src/routes/image.d.ts +1 -1
- package/elysia/src/routes/index.d.ts +1 -1
- package/elysia/src/routes/internal.d.ts +2 -2
- package/elysia/src/routes/internal.d.ts.map +1 -1
- package/elysia/src/routes/llms.d.ts +1 -1
- package/elysia/src/routes/og.d.ts +1 -1
- package/elysia/src/routes/og.d.ts.map +1 -1
- package/elysia/src/routes/redirects.d.ts +1 -1
- package/elysia/src/routes/robots.d.ts +1 -1
- package/elysia/src/routes/rss.d.ts +1 -1
- package/elysia/src/routes/search.d.ts +1 -1
- package/elysia/src/routes/sitemap.d.ts +1 -1
- package/elysia/src/routes/ssr.d.ts +1 -1
- package/elysia/src/routes/static.d.ts +1 -1
- package/elysia/src/types.d.ts +1 -1
- package/package.json +1 -1
- package/react/index.d.ts +1 -1
- package/react/index.js +58 -17
- package/react/index.js.map +6 -6
- package/react/src/components/ClientOnly.d.ts +1 -1
- package/react/src/components/ContentRoute.d.ts +1 -1
- package/react/src/components/Image.d.ts +1 -1
- package/react/src/components/LazyRoute.d.ts +1 -1
- package/react/src/components/Link.d.ts +3 -3
- package/react/src/components/Link.d.ts.map +1 -1
- package/react/src/components/Markdown.d.ts +1 -1
- package/react/src/components/Outlet.d.ts +1 -1
- package/react/src/components/index.d.ts +1 -1
- package/react/src/hooks/index.d.ts +1 -1
- package/react/src/hooks/useContent.d.ts +1 -1
- package/react/src/hooks/useData.d.ts +1 -1
- package/react/src/hooks/useData.d.ts.map +1 -1
- package/react/src/hooks/useFeed.d.ts +1 -1
- package/react/src/hooks/useLayoutData.d.ts +1 -1
- package/react/src/hooks/useLayoutData.d.ts.map +1 -1
- package/react/src/hooks/useLlms.d.ts +1 -1
- package/react/src/hooks/useNavigate.d.ts +1 -1
- package/react/src/hooks/useParams.d.ts +1 -1
- package/react/src/hooks/useRouter.d.ts +1 -1
- package/react/src/hooks/useSearch.d.ts +1 -1
- package/react/src/hooks/useSearchParams.d.ts +1 -1
- package/react/src/hooks/useToc.d.ts +1 -1
- package/react/src/index.d.ts +1 -1
- package/react/src/lib/collection.d.ts +1 -1
- package/react/src/lib/content.d.ts +1 -1
- package/react/src/lib/head.d.ts +1 -1
- package/react/src/lib/index.d.ts +1 -1
- package/react/src/lib/lazy-route.d.ts +1 -1
- package/react/src/lib/route-loader.d.ts +1 -1
- package/react/src/providers/ContentProvider.d.ts +1 -1
- package/react/src/providers/RerouteProvider.d.ts +1 -1
- package/react/src/providers/RouterProvider.d.ts +1 -1
- package/react/src/providers/RouterProvider.d.ts.map +1 -1
- package/react/src/providers/index.d.ts +1 -1
- package/react/src/types/any.d.ts +1 -1
- package/react/src/types/index.d.ts +1 -1
- package/react/src/types/router.d.ts +1 -1
- package/telemetry/react.d.ts +1 -1
- package/telemetry/react.js +2 -2
- package/telemetry/react.js.map +1 -1
- package/telemetry/server.d.ts +1 -1
- package/telemetry/server.js +2 -2
- package/telemetry/server.js.map +1 -1
- package/telemetry/src/react/api.d.ts +1 -1
- package/telemetry/src/react/context.d.ts +1 -1
- package/telemetry/src/react/index.d.ts +1 -1
- package/telemetry/src/react/telemetry.d.ts +1 -1
- package/telemetry/src/server/context.d.ts +1 -1
- package/telemetry/src/server/headers/extractor.d.ts +1 -1
- package/telemetry/src/server/headers/index.d.ts +1 -1
- package/telemetry/src/server/headers/presets.d.ts +1 -1
- package/telemetry/src/server/index.d.ts +1 -1
- package/telemetry/src/server/instrumentation.d.ts +1 -1
- package/telemetry/src/server/plugin.d.ts +1 -1
- package/telemetry/src/server/sourcemap.d.ts +1 -1
package/elysia/src/index.d.ts
CHANGED
package/elysia/src/plugin.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../../../../../packages/elysia/src/routes/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAQ,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGtD,KAAK,gBAAgB,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,OAAO,EAAE,gBAAgB,GACvB,MAAM,
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../../../../../packages/elysia/src/routes/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAQ,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGtD,KAAK,gBAAgB,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,EACrC,OAAO,EAAE,gBAAgB,GACvB,MAAM,CA4FR"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* reroute-js v0.43.
|
|
2
|
+
* reroute-js v0.43.2
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 stewones <hi@stewan.io>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Built with Bun <3
|
|
9
9
|
*/
|
|
10
10
|
import type { Elysia } from 'elysia';
|
|
11
|
-
import {
|
|
11
|
+
import type { LRUCache } from 'reroute-js/core';
|
|
12
12
|
type InternalRouteOptions = {
|
|
13
13
|
clientDir: string;
|
|
14
14
|
cwd: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../../../packages/elysia/src/routes/internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../../../packages/elysia/src/routes/internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAIhD,KAAK,oBAAoB,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAmBF;;;;GAIG;AACH,wBAAgB,sBAAsB,CACrC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,oBAAoB,GACxB,MAAM,CA8OR;AAED;;GAEG;AACH,KAAK,eAAe,GAAG;IACtB,OAAO,EAAE,GAAG,CAAC,+BAA+B,CAAC,CAAC;IAC9C,aAAa,EAAE,OAAO,CAAC;CACvB,CAAC;AAuKF;;GAEG;AACH,wBAAgB,wBAAwB,CACvC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,eAAe,GACpB,MAAM,CA2DR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"og.d.ts","sourceRoot":"","sources":["../../../../../../packages/elysia/src/routes/og.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAIN,KAAK,QAAQ,EAGb,KAAK,cAAc,EAEnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,gBAAgB,EAAc,MAAM,iBAAiB,CAAC;AAGpE,KAAK,cAAc,GAAG;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC5C,CAAC;AAmUF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"og.d.ts","sourceRoot":"","sources":["../../../../../../packages/elysia/src/routes/og.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAIN,KAAK,QAAQ,EAGb,KAAK,cAAc,EAEnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,gBAAgB,EAAc,MAAM,iBAAiB,CAAC;AAGpE,KAAK,cAAc,GAAG;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC5C,CAAC;AAmUF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,CA6O7E"}
|
package/elysia/src/types.d.ts
CHANGED
package/package.json
CHANGED
package/react/index.d.ts
CHANGED
package/react/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* reroute-js v0.43.
|
|
2
|
+
* reroute-js v0.43.2
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 stewones <hi@stewan.io>
|
|
@@ -1277,6 +1277,9 @@ function RouterProvider({
|
|
|
1277
1277
|
useEffect4(() => {
|
|
1278
1278
|
setViewTransitionsEnabled(viewTransitions);
|
|
1279
1279
|
setScrollRestorationEnabled(scrollRestoration);
|
|
1280
|
+
if (isBrowser2 && "scrollRestoration" in window.history) {
|
|
1281
|
+
window.history.scrollRestoration = "manual";
|
|
1282
|
+
}
|
|
1280
1283
|
}, [viewTransitions, scrollRestoration]);
|
|
1281
1284
|
const serverSnapshotRef = React.useRef(null);
|
|
1282
1285
|
if (!serverSnapshotRef.current) {
|
|
@@ -1712,9 +1715,8 @@ function useData(key) {
|
|
|
1712
1715
|
if (pending[pathToFetch]) {
|
|
1713
1716
|
return;
|
|
1714
1717
|
}
|
|
1715
|
-
pending[pathToFetch] = true;
|
|
1716
1718
|
const fetchPath = pathToFetch === pathname ? pathname : pathToFetch;
|
|
1717
|
-
fetch(`/__reroute_data?path=${encodeURIComponent(fetchPath)}`, {
|
|
1719
|
+
const fetchPromise = fetch(`/__reroute_data?path=${encodeURIComponent(fetchPath)}`, {
|
|
1718
1720
|
headers: { Accept: "application/json" },
|
|
1719
1721
|
credentials: "same-origin"
|
|
1720
1722
|
}).then((r) => r.ok ? r.json() : null).then((j) => {
|
|
@@ -1725,6 +1727,7 @@ function useData(key) {
|
|
|
1725
1727
|
const keys = [];
|
|
1726
1728
|
for (const [key2, value] of Object.entries(payload)) {
|
|
1727
1729
|
if (key2 !== "__reroute_multiple__") {
|
|
1730
|
+
console.log("[useData MUTATION 1] Setting", key2, "to", value, "payload is:", payload);
|
|
1728
1731
|
w.__REROUTE_DATA__[key2] = value;
|
|
1729
1732
|
keys.push(key2);
|
|
1730
1733
|
}
|
|
@@ -1757,6 +1760,7 @@ function useData(key) {
|
|
|
1757
1760
|
const keys = [];
|
|
1758
1761
|
for (const [key2, value] of Object.entries(payload)) {
|
|
1759
1762
|
if (key2.startsWith("__layout:")) {
|
|
1763
|
+
console.log("[useData MUTATION 4] Setting layout key", key2, "to", value);
|
|
1760
1764
|
w.__REROUTE_DATA__[key2] = value;
|
|
1761
1765
|
keys.push(key2);
|
|
1762
1766
|
}
|
|
@@ -1764,6 +1768,7 @@ function useData(key) {
|
|
|
1764
1768
|
if (!isLikelyDataKey && layoutKeys.length === Object.keys(payload).length) {
|
|
1765
1769
|
if (layoutKeys.length === 1) {
|
|
1766
1770
|
const layoutValue = payload[layoutKeys[0]];
|
|
1771
|
+
console.log("[useData MUTATION 5] Setting pathname", pathname, "to layoutValue", layoutValue, "payload:", payload);
|
|
1767
1772
|
w.__REROUTE_DATA__[pathname] = layoutValue;
|
|
1768
1773
|
keys.push(pathname);
|
|
1769
1774
|
} else {
|
|
@@ -1775,6 +1780,7 @@ function useData(key) {
|
|
|
1775
1780
|
}
|
|
1776
1781
|
}
|
|
1777
1782
|
if (Object.keys(mergedLayoutData).length > 0) {
|
|
1783
|
+
console.log("[useData MUTATION 6] Setting pathname", pathname, "to mergedLayoutData", mergedLayoutData);
|
|
1778
1784
|
w.__REROUTE_DATA__[pathname] = mergedLayoutData;
|
|
1779
1785
|
keys.push(pathname);
|
|
1780
1786
|
}
|
|
@@ -1789,6 +1795,7 @@ function useData(key) {
|
|
|
1789
1795
|
}
|
|
1790
1796
|
}
|
|
1791
1797
|
const targetKey = isLikelyDataKey ? pathToFetch : k;
|
|
1798
|
+
console.log("[useData MUTATION 7] Setting targetKey", targetKey, "to payload", payload, "k:", k, "pathToFetch:", pathToFetch);
|
|
1792
1799
|
w.__REROUTE_DATA__[targetKey] = payload;
|
|
1793
1800
|
try {
|
|
1794
1801
|
w.dispatchEvent(new CustomEvent("__reroute_data__", {
|
|
@@ -1804,12 +1811,38 @@ function useData(key) {
|
|
|
1804
1811
|
delete w.__REROUTE_DATA_PENDING__[pathToFetch];
|
|
1805
1812
|
} catch {}
|
|
1806
1813
|
});
|
|
1814
|
+
pending[pathToFetch] = fetchPromise;
|
|
1807
1815
|
} catch {}
|
|
1808
1816
|
}, [k, pathname]);
|
|
1809
1817
|
return useMemo5(() => {
|
|
1810
1818
|
try {
|
|
1811
1819
|
const source = typeof window === "undefined" ? globalThis.__REROUTE_DATA__ : window.__REROUTE_DATA__;
|
|
1812
1820
|
let value = source?.[k];
|
|
1821
|
+
if (value === undefined && typeof window !== "undefined") {
|
|
1822
|
+
const w = window;
|
|
1823
|
+
const pending = w.__REROUTE_DATA_PENDING__;
|
|
1824
|
+
const pendingPromise = pending?.[k] || pending?.[pathname];
|
|
1825
|
+
if (pendingPromise && typeof pendingPromise !== "boolean") {
|
|
1826
|
+
throw pendingPromise;
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
if (typeof value === "object" && value !== null && value === source) {
|
|
1830
|
+
if (typeof source === "object" && source !== null && k in source) {
|
|
1831
|
+
value = source[k];
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
if (typeof value === "object" && value !== null && typeof k === "string" && k.startsWith("/") && typeof source === "object" && source !== null) {
|
|
1835
|
+
const valueKeys = Object.keys(value);
|
|
1836
|
+
const hasLayoutKeys = valueKeys.some((key2) => key2.startsWith("__layout:"));
|
|
1837
|
+
const hasPathnameKey = k in value;
|
|
1838
|
+
if (hasLayoutKeys && hasPathnameKey) {
|
|
1839
|
+
console.warn("[useData] BUG DETECTED: value contains both layout and pathname keys, extracting pathname data for:", k);
|
|
1840
|
+
const extractedValue = value[k];
|
|
1841
|
+
if (extractedValue !== undefined) {
|
|
1842
|
+
value = extractedValue;
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1813
1846
|
if (typeof value === "object" && value !== null && typeof window !== "undefined") {
|
|
1814
1847
|
const keys = Object.keys(value);
|
|
1815
1848
|
const layoutKeys = keys.filter((key2) => key2.startsWith("__layout:"));
|
|
@@ -1880,7 +1913,7 @@ function useData(key) {
|
|
|
1880
1913
|
}
|
|
1881
1914
|
return;
|
|
1882
1915
|
}
|
|
1883
|
-
}, [k, _tick]);
|
|
1916
|
+
}, [k, _tick, pathname]);
|
|
1884
1917
|
}
|
|
1885
1918
|
// packages/react/src/hooks/useFeed.ts
|
|
1886
1919
|
import { useMemo as useMemo6 } from "react";
|
|
@@ -2013,7 +2046,10 @@ function useLayoutData() {
|
|
|
2013
2046
|
return useMemo7(() => {
|
|
2014
2047
|
try {
|
|
2015
2048
|
const source = typeof window === "undefined" ? globalThis.__REROUTE_DATA__ : window.__REROUTE_DATA__;
|
|
2016
|
-
|
|
2049
|
+
let value = source?.[layoutKey];
|
|
2050
|
+
if (value === undefined && layoutKey !== "__layout:/") {
|
|
2051
|
+
value = source?.["__layout:/"];
|
|
2052
|
+
}
|
|
2017
2053
|
if (typeof value === "object" && value !== null && value.__lazy__ === true) {
|
|
2018
2054
|
const fetchUrl = value.__fetch__;
|
|
2019
2055
|
if (typeof fetchUrl === "string" && typeof window !== "undefined") {
|
|
@@ -2721,7 +2757,7 @@ function dispatchDataEvent(detail) {
|
|
|
2721
2757
|
window.dispatchEvent(new CustomEvent("__reroute_data__", { detail }));
|
|
2722
2758
|
} catch {}
|
|
2723
2759
|
}
|
|
2724
|
-
function storeAndDispatchData(path, payload) {
|
|
2760
|
+
function storeAndDispatchData(path, payload, silent = false) {
|
|
2725
2761
|
if (!payload || typeof payload !== "object")
|
|
2726
2762
|
return;
|
|
2727
2763
|
const store = getRerouteDataStore();
|
|
@@ -2730,17 +2766,20 @@ function storeAndDispatchData(path, payload) {
|
|
|
2730
2766
|
for (const key of keys) {
|
|
2731
2767
|
store[key] = payload[key];
|
|
2732
2768
|
}
|
|
2733
|
-
|
|
2769
|
+
if (!silent)
|
|
2770
|
+
dispatchDataEvent({ keys });
|
|
2734
2771
|
} else if (payload.__flatten__ === true || payload.__reroute_flattened__ === true) {
|
|
2735
2772
|
const keys = Object.keys(payload).filter((k) => k !== "__flatten__" && k !== "__reroute_flattened__");
|
|
2736
2773
|
for (const key of keys) {
|
|
2737
2774
|
store[key] = payload[key];
|
|
2738
2775
|
}
|
|
2739
2776
|
store[path] = payload;
|
|
2740
|
-
|
|
2777
|
+
if (!silent)
|
|
2778
|
+
dispatchDataEvent({ keys: [...keys, path] });
|
|
2741
2779
|
} else {
|
|
2742
2780
|
store[path] = payload;
|
|
2743
|
-
|
|
2781
|
+
if (!silent)
|
|
2782
|
+
dispatchDataEvent({ key: path });
|
|
2744
2783
|
}
|
|
2745
2784
|
}
|
|
2746
2785
|
function needsDataPrefetch(path, inferred, matchRoute) {
|
|
@@ -2752,8 +2791,10 @@ function needsDataPrefetch(path, inferred, matchRoute) {
|
|
|
2752
2791
|
if (store[path] !== undefined)
|
|
2753
2792
|
return false;
|
|
2754
2793
|
const route = matchRoute?.(path)?.route;
|
|
2755
|
-
const
|
|
2756
|
-
|
|
2794
|
+
const hasSSRData = !!(route?.ssr && typeof route.ssr === "object" && typeof route.ssr.data === "function");
|
|
2795
|
+
if (hasSSRData)
|
|
2796
|
+
return false;
|
|
2797
|
+
return isDynamic;
|
|
2757
2798
|
}
|
|
2758
2799
|
async function fetchRouteData(path, signal) {
|
|
2759
2800
|
try {
|
|
@@ -2782,10 +2823,10 @@ async function fetchRouteData(path, signal) {
|
|
|
2782
2823
|
return null;
|
|
2783
2824
|
}
|
|
2784
2825
|
}
|
|
2785
|
-
function prefetchRouteData(path) {
|
|
2826
|
+
function prefetchRouteData(path, silent = false) {
|
|
2786
2827
|
fetchRouteData(path).then((payload) => {
|
|
2787
2828
|
if (payload)
|
|
2788
|
-
storeAndDispatchData(path, payload);
|
|
2829
|
+
storeAndDispatchData(path, payload, silent);
|
|
2789
2830
|
});
|
|
2790
2831
|
}
|
|
2791
2832
|
async function prefetchRouteDataWithTimeout(path, timeoutMs = 350) {
|
|
@@ -2858,7 +2899,7 @@ function Link({
|
|
|
2858
2899
|
if (options?.withTimeout) {
|
|
2859
2900
|
prefetchRouteDataWithTimeout(localUrl.path);
|
|
2860
2901
|
} else {
|
|
2861
|
-
prefetchRouteData(localUrl.path);
|
|
2902
|
+
prefetchRouteData(localUrl.path, options?.silent);
|
|
2862
2903
|
}
|
|
2863
2904
|
} else if (inferred?.module) {
|
|
2864
2905
|
prefetchContent(inferred);
|
|
@@ -2899,7 +2940,7 @@ function Link({
|
|
|
2899
2940
|
if (prefetch) {
|
|
2900
2941
|
const localUrl = parseLocalUrl(String(to));
|
|
2901
2942
|
if (localUrl)
|
|
2902
|
-
triggerPrefetch(localUrl);
|
|
2943
|
+
triggerPrefetch(localUrl, { silent: true });
|
|
2903
2944
|
}
|
|
2904
2945
|
onMouseEnter?.(e);
|
|
2905
2946
|
}, [prefetch, to, triggerPrefetch, onMouseEnter]);
|
|
@@ -2907,7 +2948,7 @@ function Link({
|
|
|
2907
2948
|
if (prefetch) {
|
|
2908
2949
|
const localUrl = parseLocalUrl(String(to));
|
|
2909
2950
|
if (localUrl)
|
|
2910
|
-
triggerPrefetch(localUrl);
|
|
2951
|
+
triggerPrefetch(localUrl, { silent: true });
|
|
2911
2952
|
}
|
|
2912
2953
|
onFocus?.(e);
|
|
2913
2954
|
}, [prefetch, to, triggerPrefetch, onFocus]);
|
|
@@ -3098,4 +3139,4 @@ export {
|
|
|
3098
3139
|
ClientOnly
|
|
3099
3140
|
};
|
|
3100
3141
|
|
|
3101
|
-
//# debugId=
|
|
3142
|
+
//# debugId=F3B49BE173ADC40164756E2164756E21
|