@solidjs/router
Advanced tools
Comparing version 0.12.0 to 0.12.1
@@ -90,4 +90,4 @@ import { createSignal, getListener, getOwner, onCleanup, sharedConfig, startTransition } from "solid-js"; | ||
res = | ||
"then" in (cached[1]) | ||
? (cached[1]).then(handleResponse(false), handleResponse(true)) | ||
"then" in cached[1] | ||
? cached[1].then(handleResponse(false), handleResponse(true)) | ||
: handleResponse(false)(cached[1]); | ||
@@ -101,11 +101,2 @@ !isServer && intent === "navigate" && startTransition(() => cached[3][1](cached[0])); // update version | ||
: fn(...args); | ||
// serialize on server | ||
if (isServer && | ||
sharedConfig.context && | ||
sharedConfig.context.async && | ||
!sharedConfig.context.noHydrate) { | ||
const e = getRequestEvent(); | ||
e && e.router.dataOnly && (e.router.data[key] = res); | ||
(!e || !e.serverOnly) && sharedConfig.context.serialize(key, res); | ||
} | ||
if (cached) { | ||
@@ -125,8 +116,21 @@ cached[0] = now; | ||
} | ||
if (isServer) { | ||
const e = getRequestEvent(); | ||
e && e.router.dataOnly && (e.router.data[key] = res); | ||
return res; | ||
} | ||
if (intent !== "preload") { | ||
res = | ||
"then" in (res) | ||
? (res).then(handleResponse(false), handleResponse(true)) | ||
"then" in res | ||
? res.then(handleResponse(false), handleResponse(true)) | ||
: handleResponse(false)(res); | ||
} | ||
// serialize on server | ||
if (isServer && | ||
sharedConfig.context && | ||
sharedConfig.context.async && | ||
!sharedConfig.context.noHydrate) { | ||
const e = getRequestEvent(); | ||
(!e || !e.serverOnly) && sharedConfig.context.serialize(key, res); | ||
} | ||
return res; | ||
@@ -133,0 +137,0 @@ function handleResponse(error) { |
@@ -470,2 +470,3 @@ import { isServer, getRequestEvent, createComponent as createComponent$1, delegateEvents, spread, mergeProps as mergeProps$1, template } from 'solid-js/web'; | ||
}); | ||
const owner = getOwner(); | ||
return { | ||
@@ -581,3 +582,6 @@ base: baseRoute, | ||
route.component && route.component.preload && route.component.preload(); | ||
preloadData && route.load && route.load({ | ||
const { | ||
load | ||
} = route; | ||
preloadData && load && runWithOwner(owner, () => load({ | ||
params, | ||
@@ -593,3 +597,3 @@ location: { | ||
intent: "preload" | ||
}); | ||
})); | ||
} | ||
@@ -932,9 +936,2 @@ intent = prevIntent; | ||
: fn(...args); | ||
// serialize on server | ||
if (isServer && sharedConfig.context && sharedConfig.context.async && !sharedConfig.context.noHydrate) { | ||
const e = getRequestEvent(); | ||
e && e.router.dataOnly && (e.router.data[key] = res); | ||
(!e || !e.serverOnly) && sharedConfig.context.serialize(key, res); | ||
} | ||
if (cached) { | ||
@@ -953,5 +950,15 @@ cached[0] = now; | ||
} | ||
if (isServer) { | ||
const e = getRequestEvent(); | ||
e && e.router.dataOnly && (e.router.data[key] = res); | ||
return res; | ||
} | ||
if (intent !== "preload") { | ||
res = "then" in res ? res.then(handleResponse(false), handleResponse(true)) : handleResponse(false)(res); | ||
} | ||
// serialize on server | ||
if (isServer && sharedConfig.context && sharedConfig.context.async && !sharedConfig.context.noHydrate) { | ||
const e = getRequestEvent(); | ||
(!e || !e.serverOnly) && sharedConfig.context.serialize(key, res); | ||
} | ||
return res; | ||
@@ -958,0 +965,0 @@ function handleResponse(error) { |
@@ -0,1 +1,2 @@ | ||
import { getOwner, runWithOwner } from "solid-js"; | ||
import { createComponent, createContext, createMemo, createRenderEffect, createSignal, on, onCleanup, untrack, useContext, startTransition, resetErrorBoundaries } from "solid-js"; | ||
@@ -239,2 +240,3 @@ import { isServer, getRequestEvent } from "solid-js/web"; | ||
}); | ||
const owner = getOwner(); | ||
return { | ||
@@ -335,5 +337,6 @@ base: baseRoute, | ||
route.component.preload(); | ||
const { load } = route; | ||
preloadData && | ||
route.load && | ||
route.load({ | ||
load && | ||
runWithOwner(owner, () => load({ | ||
params, | ||
@@ -349,3 +352,3 @@ location: { | ||
intent: "preload" | ||
}); | ||
})); | ||
} | ||
@@ -352,0 +355,0 @@ intent = prevIntent; |
@@ -9,3 +9,3 @@ { | ||
"license": "MIT", | ||
"version": "0.12.0", | ||
"version": "0.12.1", | ||
"homepage": "https://github.com/solidjs/solid-router#readme", | ||
@@ -12,0 +12,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
161770
3630