lit / lit/lit

[labs/ssr] Textarea value is not server side rendered

Open
#4,915 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
21.8k
Forks
1.1k
Avg merge
18h 25m
Merged PRs (30d)
2

Description

### Which package(s) are affected?

SSR (@lit-labs/ssr)

### Description

When you try to SSR a textarea as ``, the value is not rendered. You get ``, instead of `John`.

On the other hand, an `` works as expected.

Example:

```js
class Foo extends LitElement {
constructor() {
super();
this.name = 'John';
}

render() {
return html`


${unsafeHTML(`${this.name}`)}
${staticHtml`${this.hasUpdated ? undefined : unsafeStatic(this.name)}`}
`;
}
}
customElements.define('my-foo', Foo);

function *renderPage() {
yield* render(html``);
}

new RenderResultReadable(renderPage())
```

This will render:

```html





John
John

```

### Reproduction

https://stackblitz.com/edit/lit-ssr-global-vvnu1gjw?file=src%2Fcomponents%2Fmy-foo.js

### Workaround

You can use:
```
${unsafeHTML(`${this.name}`)}
```
or

```
${staticHtml`${this.hasUpdated ? undefined : unsafeStatic(this.name)}`}
```

### Is this a regression?

No or unsure. This never worked, or I haven't tried before.

### Affected versions

3.3.0

### Browser/OS/Node environment

Node: 20+

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue identifies @lit-labs/ssr and provides a StackBlitz reproduction; start by running that reproduction and tracing textarea handling in the SSR package. Done means the .value binding renders John, while the existing input behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.