Skip to content

Commit

Permalink
fix #2047 early interaction/multiple resources
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansolid committed Feb 14, 2024
1 parent c71b6fe commit 829af66
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/fifty-rockets-yawn.md
@@ -0,0 +1,5 @@
---
"solid-js": patch
---

fix #2047 early interaction/multiple resources
27 changes: 16 additions & 11 deletions packages/solid/src/render/Suspense.ts
Expand Up @@ -144,21 +144,26 @@ export function Suspense(props: { fallback?: JSX.Element; children: JSX.Element
if (sharedConfig.context && sharedConfig.load) {
const key = sharedConfig.context.id + sharedConfig.context.count;
let ref = sharedConfig.load(key);
if (ref && (typeof ref !== "object" || ref.status !== "success")) p = ref;
if (ref) {
if (typeof ref !== "object" || ref.status !== "success") p = ref;
else sharedConfig.gather!(key);
}
if (p && p !== "$$f") {
const [s, set] = createSignal(undefined, { equals: false });
flicker = s;
p.then(() => {
sharedConfig.gather!(key);
setHydrateContext(ctx);
set();
setHydrateContext();
}).catch((err: any) => {
if (err || sharedConfig.done) {
err && (error = err);
return set();
p.then(
() => {
if (sharedConfig.done) return set();
sharedConfig.gather!(key);
setHydrateContext(ctx);
set();
setHydrateContext();
},
(err: any) => {
error = err;
set();
}
});
);
}
}

Expand Down

0 comments on commit 829af66

Please sign in to comment.