Skip to content

Commit 0a1b325

Browse files
authored
fix(docs): update SSR boot file template variable syntax for app-vite v2 (quasarframework#18247)
In @quasar/app-vite v2, the render-template is compiled with { variable: 'ssrContext' }, which scopes all interpolations under the ssrContext object. The previously documented {{ someProp }} syntax no longer works; the correct syntax is {{ ssrContext.someProp }}. Updated the example in the Boot Files section of the Configuring SSR page to reflect this change, and added a tip callout to help users upgrading from v1.
1 parent aff2edb commit 0a1b325

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

docs/src/pages/quasar-cli-vite/developing-ssr/configuring-ssr.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,16 @@ When a boot file runs on the server, you will have access to one more parameter
236236
export default ({ app, ..., ssrContext }) => {
237237
// You can add props to the ssrContext then use them in the /index.html.
238238
// Example - let's say we ssrContext.someProp = 'some value', then in index template we can reference it:
239-
// {{ someProp }}
239+
// {{ ssrContext.someProp }}
240240
}
241241
```
242242

243-
When you add such references (`someProp` surrounded by brackets in the example above) into your `/index.html`, make sure you tell Quasar it’s only valid for SSR builds:
243+
When you add such references into your `/index.html`, make sure you tell Quasar it's only valid for SSR builds:
244+
245+
::: tip
246+
As of `@quasar/app-vite` v2, template variables in `/index.html` must be scoped under the `ssrContext` object. Use `{{ ssrContext.someProp }}` instead of the v1 form `{{ someProp }}`.
247+
:::
244248

245249
```html /index.html
246-
<% if (ctx.mode.ssr) { %>{{ someProp }} <% } %>
250+
<% if (ctx.mode.ssr) { %>{{ ssrContext.someProp }} <% } %>
247251
```

0 commit comments

Comments
 (0)