Comparing version 1.6.7 to 1.6.8
@@ -495,15 +495,8 @@ const equalFn = (a, b) => a === b; | ||
function lazy(fn) { | ||
let resolved; | ||
let p; | ||
let load = id => { | ||
if (!p) { | ||
if (id) { | ||
let ref = sharedConfig.context.resources[id] = { | ||
ref: p = fn() | ||
}; | ||
p.then(mod => ref.data = resolved = mod.default); | ||
return p; | ||
} | ||
p = fn(); | ||
p.then(mod => resolved = mod.default); | ||
p.then(mod => p.resolved = mod.default); | ||
if (id) sharedConfig.context.lazy[id] = p; | ||
} | ||
@@ -515,8 +508,5 @@ return p; | ||
const id = sharedConfig.context.id.slice(0, -1); | ||
let ref = sharedConfig.context.resources[id]; | ||
if (ref) { | ||
p = ref.ref; | ||
resolved = ref.data; | ||
} else load(id); | ||
if (resolved) return resolved(props); | ||
let ref = sharedConfig.context.lazy[id]; | ||
if (ref) p = ref;else load(id); | ||
if (p.resolved) return p.resolved(props); | ||
const ctx = useContext(SuspenseContext); | ||
@@ -523,0 +513,0 @@ const track = { |
{ | ||
"name": "solid-js", | ||
"description": "A declarative JavaScript library for building user interfaces.", | ||
"version": "1.6.7", | ||
"version": "1.6.8", | ||
"author": "Ryan Carniato", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -137,2 +137,3 @@ import { Setter, Signal } from "./reactive.js"; | ||
registerFragment: (v: string) => (v?: string, err?: any) => boolean; | ||
lazy: Record<string, Promise<any>>; | ||
async?: boolean; | ||
@@ -139,0 +140,0 @@ noHydrate: boolean; |
@@ -270,2 +270,3 @@ import { sharedConfig, splitProps } from 'solid-js'; | ||
suspense: {}, | ||
lazy: {}, | ||
assets: [], | ||
@@ -352,2 +353,3 @@ nonce: options.nonce, | ||
resources: {}, | ||
lazy: {}, | ||
suspense: {}, | ||
@@ -354,0 +356,0 @@ assets: [], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
790111
21960