Skip to content
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

Open
axel-habermaier opened this issue Jan 10, 2025 · 1 comment
Open

Invalid double escaping of nested arrays in SSR #393

axel-habermaier opened this issue Jan 10, 2025 · 1 comment

Comments

@axel-habermaier
Copy link

axel-habermaier commented Jan 10, 2025

Consider the following code:

function Test() {
  const a = ["<"];
  return <div>{[a, a]}</div>;
}

During SSR, this incorrectly renders the HTML <div>&amp;lt;&amp;lt;</div>, i.e., the < is escaped twice and is thus shown as &lt;&lt; in the browser.

I expected SSR to generate the single-escaped HTML <div>&lt;&lt;</div> which then renders as << in the browser.

@axel-habermaier axel-habermaier changed the title Invalid double escaping Invalid double escaping of nested arrays in SSR Jan 10, 2025
@axel-habermaier
Copy link
Author

axel-habermaier commented Jan 14, 2025

Update: The underlying reason seems to be that the array a is unexpectedly modified during rendering! So if a were at module scope, there would be additional escaping for each render.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant