Skip to content

Commit 38fe44d

Browse files
committed
docs(use-hydration): document fallback hydration behavior when plugin is not installed
1 parent 62d0e82 commit 38fe44d

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

apps/docs/src/pages/composables/plugins/use-hydration.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,19 @@ All properties are `Readonly<ShallowRef>` and update when the root component mou
8989
| `isHydrated` | `ShallowRef<boolean>` | True after root component mounts |
9090
| `isSettled` | `ShallowRef<boolean>` | True after next tick post-hydration |
9191

92+
## Fallback Hydration
93+
94+
When `useHydration()` is called without the plugin installed (no `createHydrationPlugin` in your app), it returns a fallback context where `isHydrated` and `isSettled` are **immediately `true`**. This means components that conditionally render based on `isHydrated` work correctly in client-only apps without any plugin setup.
95+
96+
```ts no-filename
97+
// Without plugin: isHydrated.value === true immediately
98+
// With plugin: isHydrated.value starts false, becomes true after mount
99+
const { isHydrated } = useHydration()
100+
```
101+
102+
> [!TIP]
103+
> The fallback is also what SSR-aware composables like `useResizeObserver` use internally — they call `useHydration()` to defer observation until after hydration, but work correctly even in environments where the plugin isn't installed.
104+
92105
## Examples
93106

94107
::: example

0 commit comments

Comments
 (0)