vani-ssr-hydration
8
总安装量
8
周安装量
#36072
全站排名
安装命令
npx skills add https://github.com/itsjavi/vani --skill vani-ssr-hydration
Agent 安装分布
claude-code
5
antigravity
4
windsurf
4
github-copilot
4
trae
4
opencode
4
Skill 文档
Vani SSR and Hydration
Instructions for rendering on the server and hydrating on the client with explicit activation.
When to Use
Use this when a project needs SSR or SSG, or when hydration must be selective.
Steps
- Render on the server with
renderToString(App())(arrays also work). - On the client, call
hydrateToDOM(App(), root)(arrays also work) to bind handles to anchors. - Activate interactivity by calling
handle.update()on the handles you want to run. - For selective hydration, update only specific handles (e.g., header) and leave others inert.
Arguments
- rootId – DOM id that contains server HTML (defaults to
app) - activateAll – whether to update all handles immediately (defaults to
true) - selectiveRefs – list of component refs to activate (defaults to
[])
Examples
Example 1 usage pattern:
SSR a page, hydrate on the client, then call handle.update() for all handles.
Example 2 usage pattern:
Hydrate a page but activate only the header using a ComponentRef.
Output
Example output:
Created: server/render.ts
Updated: client/entry.ts
Notes: Hydration binds to anchors; update() activates UI.
Present Results to User
Summarize the SSR/hydration flow, note which handles are activated, and list file changes.
name: vani-ssr-hydration description: Apply Vani SSR, hydration, and client-only islands correctly. argument-hint: “[rendering mode or feature]”
Vani SSR and Hydration Command
When to use
Use this skill when implementing SSR, SSG, hydration, or client-only islands.
Instructions
Follow these steps:
- For SSR/SSG, render with
renderToString()on the server (single or array). - Bind on the client with
hydrateToDOM()(single or array); do not expect it to render. - Activate UI by calling
handle.update()on chosen handles. - Use
clientOnly: truefor islands that should skip SSR. - Keep hydration order identical to the server render order.
Output expectations
- Use only
@vanijs/vanior other public packages. - Do not assume hydration runs effects before
handle.update(). - If $ARGUMENTS is provided, pick the correct render/hydration strategy.