fastify / fastify/fastify-vite

clientOnly not updated on reload in dev mode

Open
#270 1 comment 0 reactions 1 assignee Claimed by @galvez View on GitHub
bug vue
Dominant language
TypeScript
Stars
1.1k
Forks
103
Avg merge
6h 54m
Merged PRs (30d)
7

Description

### Prerequisites

- [x] I have written a descriptive issue title
- [x] I have searched existing issues to ensure the bug has not already been reported

### Fastify version

5.3.2

### Plugin version

5.3.2

### Node.js version

20.11.0

### Operating system

macOS

### Operating system version (i.e. 20.04, 11.3, 10)

sequoia

### Description

I'm just trying to get started with fastify/vue and checking the basics.

Using the boilerplate "index.vue" I tried to add an onEnter function to change the clientOnly value of the context in dev mode and reloaded the page looking at the source code.

```
export function onEnter(ctx) {
ctx.clientOnly = true;
}
```

Nothing happened, there is still html output in the root div of the sourcecode of the page (using
`view-source:http://localhost:3000/`), although the console shows
```
[vite] program reload
[vite] program reload
```

After terminating the server (CTRL + C) and restarting using `npm run dev` I can see that now the root div is empty, so the content is rendered on the client.

I guess a program reload should be enough to switch the clientOnly rendering behaviour (?)

### Link to code that reproduces the bug

https://github.com/bschelling/fastify-vue-clientonly/blob/main/client/pages/index.vue

### Expected Behavior

Reload in devmode show switch the clientOnly mode.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.