Why donate
API Explorer
Upgrade Guide
Creating a New Project
The /quasar.config File
Convert q/app-webpack Project
Browser Compatibility
TypeScript Support
Directory Structure
Commands List
CSS Preprocessors
Page Routing with VueRouter
Lazy Loading - Code Splitting
Handling Assets
Boot Files
Prefetch Feature
API Proxying
Handling Vite
Handling import.meta.env
State Management with Pinia
Lint and Format Code
Testing & Auditing
Developing Mobile Apps
Fetching Data
Opening Dev Server To Public
Quasar CLI with Vite - @quasar/app-vite v3
SSR FAQ

Why am I getting hydration errors?

Take a look at the Client Side Hydration page. A mismatch means the server-rendered HTML differs from the client’s initial render. Development builds provide the useful diagnostics, but the underlying mismatch can also affect production and should be fixed before release. Use QNoSsr for content that can only be rendered in the browser.

Why doesn’t importing Platform and Cookies work?

When building for SSR, use only the $q.platform / $q.cookies form. Alternatively, when on server-side, this is one more example of how you can use it:

// example with Platform; same thing for Cookies
import { Platform } from 'quasar'

// you need access to `ssrContext`
function (ssrContext) {
  const platform = import.meta.env.QUASAR_SERVER
    ? Platform.parseSSR(ssrContext)
    : Platform // otherwise we're on client

  // platform is equivalent to the global import as in non-SSR builds
}

The ssrContext is available in the Boot Files or the PreFetch Feature, where it is supplied as a parameter.

There is a good reason for this. In a client-only app, every user will be using a fresh instance of the app in their browser. For server-side rendering we want the same thing. Each request should have a fresh, isolated app instance so that there is no cross-request state pollution. So Platform and Cookies need to be bound to each request separately.

Also a good idea is to read the Writing Universal Code documentation page.

Why isn’t LocalStorage and SessionStorage working?

Web Storage is a browser-only API and is unavailable while code runs on the server. Access it only in client-side code, such as after the component mounts.