Fix streaming resolveSuspense: use callFn instead of eval string interpolation
The previous K.eval() approach double-escaped backslashes in SX source strings, breaking the \/ → / unescaping that the server serializer adds for HTML safety. Using K.callFn() passes strings directly as arguments, bypassing the escaping problem entirely. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -700,8 +700,9 @@
|
|||||||
K.eval("(handle-popstate " + scrollY + ")");
|
K.eval("(handle-popstate " + scrollY + ")");
|
||||||
});
|
});
|
||||||
// Wire up streaming suspense resolution
|
// Wire up streaming suspense resolution
|
||||||
|
var _resolveFn = K.eval("resolve-suspense");
|
||||||
Sx.resolveSuspense = function(id, sx) {
|
Sx.resolveSuspense = function(id, sx) {
|
||||||
try { K.eval('(resolve-suspense "' + id.replace(/"/g, '\\"') + '" "' + sx.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '")'); }
|
try { K.callFn(_resolveFn, [id, sx]); }
|
||||||
catch(e) { console.error("[sx] resolveSuspense error:", e); }
|
catch(e) { console.error("[sx] resolveSuspense error:", e); }
|
||||||
};
|
};
|
||||||
// Drain any pending resolves that arrived before boot
|
// Drain any pending resolves that arrived before boot
|
||||||
|
|||||||
@@ -700,8 +700,9 @@
|
|||||||
K.eval("(handle-popstate " + scrollY + ")");
|
K.eval("(handle-popstate " + scrollY + ")");
|
||||||
});
|
});
|
||||||
// Wire up streaming suspense resolution
|
// Wire up streaming suspense resolution
|
||||||
|
var _resolveFn = K.eval("resolve-suspense");
|
||||||
Sx.resolveSuspense = function(id, sx) {
|
Sx.resolveSuspense = function(id, sx) {
|
||||||
try { K.eval('(resolve-suspense "' + id.replace(/"/g, '\\"') + '" "' + sx.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '")'); }
|
try { K.callFn(_resolveFn, [id, sx]); }
|
||||||
catch(e) { console.error("[sx] resolveSuspense error:", e); }
|
catch(e) { console.error("[sx] resolveSuspense error:", e); }
|
||||||
};
|
};
|
||||||
// Drain any pending resolves that arrived before boot
|
// Drain any pending resolves that arrived before boot
|
||||||
|
|||||||
Reference in New Issue
Block a user