Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/malcolmstill/astro-lit-hydration-issue


https://github.com/malcolmstill/astro-lit-hydration-issue

Last synced: 30 days ago
JSON representation

Awesome Lists containing this project

README

        

# Astro + Lit SSR hydration issue

Screenshot 2023-11-01 at 12 19 37

Component `B` (child of component `A`) fails to hydrate when using SSR.

In component `C` and `D` I instead define constructors to set the properties hydration seems to work but then `items` in component `D` is at some point `undefined` and an error is thrown.

- Is this a bug / issue?
- Am I holding astro, lit or astro + lit wrong?

## Details

This is a minimal reproduction built by:

1. Create astro project
```
npm create astro@latest
```

(empty project using typescript)

2. Add lit

```
npx astro add lit
```

3. Update tsconfig

Add options `experimentalDecorators` `true` and `useDefineForClassFields` `false`:

```
{
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false
}
}

```

4. Add components (see `index.astro` + `src/components/`)