Open lilnasy opened 6 months ago
Astro v4.5.0 Node v18.18.0 System Linux (x64) Package Manager npm Output static Adapter none Integrations @astrojs/preact
No response
Component renders twice and this.state is always {} the second time, resulting in a runtime error.
this.state
{}
export default class extends Component { state = { poo: { bar: 'hello' } }; render() { return <div>{this.state.poo.bar}</div>; } }
The component renders on the server successfully same as it does in the browser with client:only directive.
client:only
https://stackblitz.com/edit/github-2lvdty?file=src%2Fpages%2Findex.astro,src%2Fcomponents%2FCounter.tsx
I thought we had an instanceof check in the Preact renderer. Might verify that's correct.
instanceof
We don't. That would be upto preact-render-to-string, I'm guessing.
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
Component renders twice and
this.state
is always{}
the second time, resulting in a runtime error.What's the expected result?
The component renders on the server successfully same as it does in the browser with
client:only
directive.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-2lvdty?file=src%2Fpages%2Findex.astro,src%2Fcomponents%2FCounter.tsx
Participation