-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid double escaping of nested arrays in SSR #393
Comments
Update: The underlying reason seems to be that the array |
Yeah, that can also be reproduced using only jsx import { renderToString } from "solid-js/web"
let x = "<"
let a = <>{x}{x}</>
let v = <>{a}{a}</>
console.log(v)
console.log(renderToString(() => <>{v}</>))
console.log(v) we definitely should create a new array here before escaping its elements dom-expressions/packages/dom-expressions/src/server.js Lines 412 to 418 in 8f9f432
also created https://github.com/mdynnl/solid-ssr-escape-bench to benchmark which approach is faster although it may vary depending on the runtime after trying with both bun(1.2.3-canary) and node(v20.17.0), i honestly don't know which one is faster as the results are entirely different, but |
@mdynnl Can you benchmark |
Consider the following code:
During SSR, this incorrectly renders the HTML
<div>&lt;&lt;</div>
, i.e., the<
is escaped twice and is thus shown as<<
in the browser.I expected SSR to generate the single-escaped HTML
<div><<</div>
which then renders as<<
in the browser.The text was updated successfully, but these errors were encountered: