Skip to content

Commit 1579648

Browse files
committed
partial fix
1 parent bfa808f commit 1579648

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "server.js",
66
"type": "module",
77
"scripts": {
8-
"dev": "vite",
8+
"dev": "vite --force",
99
"build": "npm run build:client && npm run build:server",
1010
"build:client": "vite build --outDir dist/client",
1111
"build:server": "vite build --ssr src/entry-server.jsx --outDir dist/server"

demo/vite.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ function ssrPlugin() {
1313
return next();
1414
}
1515

16-
const { render } = await server.ssrLoadModule(
16+
const { render, abort } = await server.ssrLoadModule(
1717
path.resolve(__dirname, './src/entry-server')
1818
);
1919

20+
setTimeout(abort, 10000);
21+
2022
const indexHtml = await fs.readFile(
2123
path.resolve(__dirname, './index.html'),
2224
'utf-8'

src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ function _renderToString(
245245
);
246246

247247
if (afterDiff) afterDiff(vnode);
248-
vnode[PARENT] = undefined;
248+
// when we are dealing with suspense we can't do this...
249+
// vnode[PARENT] = undefined;
249250

250251
if (options.unmount) options.unmount(vnode);
251252

@@ -394,7 +395,7 @@ function _renderToString(
394395
}
395396

396397
if (afterDiff) afterDiff(vnode);
397-
vnode[PARENT] = undefined;
398+
//vnode[PARENT] = undefined;
398399
if (ummountHook) ummountHook(vnode);
399400

400401
// Emit self-closing tag for empty void elements:

src/lib/chunked.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export async function renderToChunks(vnode, { context, onWrite, abortSignal }) {
3939
function handleError(error, vnode, renderChild) {
4040
if (!error || !error.then) return;
4141

42+
console.log('--- IN HANDLER ---');
4243
// walk up to the Suspense boundary
4344
while ((vnode = vnode[PARENT])) {
4445
let component = vnode[COMPONENT];
@@ -50,6 +51,7 @@ function handleError(error, vnode, renderChild) {
5051
if (!vnode) return;
5152

5253
let root = vnode;
54+
// TODO: we can't unset parent because of this traversal to Suspense
5355
while (root !== null && !root.mask && root[PARENT] !== null) {
5456
root = root[PARENT];
5557
}
@@ -68,6 +70,7 @@ function handleError(error, vnode, renderChild) {
6870

6971
const promise = error.then(
7072
() => {
73+
console.log('resolved');
7174
if (abortSignal && abortSignal.aborted) return;
7275
this.onWrite(createSubtree(id, renderChild(vnode.props.children)));
7376
},

0 commit comments

Comments
 (0)