Comments (6)
Hi @berlysia Thanks for the report!
cc @yusukebe
#35 will partially fix this problem, but it does not work correctly when children is a function component. I have an idea to deal with this, so please give me a few days.
from honox.
Support children with server-side Suspense
(streaming) is coming soon.
- Hydrate without waiting for the server side Suspense to resolve, and user can click button.
- Children are updated according to the server-side Suspense resolve.
ServerClientComponents.mp4
const ChildContent3 = async () => {
await new Promise((resolve) => setTimeout(resolve, 1000))
throw new Error('Error in child content 3')
}
const ChildContent2 = async () => {
await new Promise((resolve) => setTimeout(resolve, 1000))
return (
<>
<p>Counter children 2</p>
<ErrorBoundary fallback={<p>Something went wrong</p>}>
<Suspense fallback="<p>Loading...</p>">
<ChildContent3 />
</Suspense>
</ErrorBoundary>
</>
)
}
const ChildContent1 = async () => {
await new Promise((resolve) => setTimeout(resolve, 1000))
return (
<>
<p>Counter children 1</p>
<Suspense fallback="<p>Loading...</p>">
<ChildContent2 />
</Suspense>
</>
)
}
const Children = async () => {
return (
<Suspense fallback="<p>Loading...</p>">
<ChildContent1 />
</Suspense>
)
}
export default createRoute((c) => {
const name = c.req.query('name') ?? 'no name'
return c.render(
<div class={className}>
<h1>Hello, {name}!</h1>
<Counter>
<Children />
</Counter>
</div>,
{ title: name }
)
})
from honox.
Hi @berlysia
This issue is resolved by #35. I'll release the new version, including the change, later.
from honox.
I've released v0.1.2, which supports that it can pass children to islands/client components (including Suspense!) thanks to @usualoma . Could you try it?
from honox.
Oops, forgot to get the attribute values!
I'll fix that right away.
from honox.
Great. The fix works for my site locally. I'm waiting for merge and publish.
from honox.
Related Issues (20)
- Routing priority HOT 5
- Get the current rendering HTTP path in the `_renderer.tsx`
- _worker.js optimization HOT 2
- methodOverride middleware doesn't work HOT 2
- Use mutationObserver to monitor for new components on the screen
- <honox-island> tag breaks direct child CSS HOT 10
- Using the React library in HonoX with hono/jsx/dom HOT 1
- Nested islands hydrate error HOT 1
- Build break by missing file or directory react/jsx-runtime?inside-island HOT 1
- When island components are nested, the child island is broken HOT 6
- Nested islands hydrate error 2 HOT 2
- Support named export not only `default` in Islands HOT 1
- support CSP nonce for `<Script>` component HOT 1
- Use comments instead of `honox-island` for marking islands HOT 3
- It would be nice to place islands anywhere, not just in routes and islands directories. HOT 4
- Is it possible to use React component frameworks? HOT 1
- Partials HOT 1
- `Script` and `HasIsland` to be available even if react is used for runtime HOT 2
- `nonce` attribute should be added only in production? HOT 4
- React Server Components (RSC) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from honox.