question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SSR async components $q.screen reactivity

See original GitHub issue

Describe the bug When using SSR and some conditional class based on $q.screen.something in an async component this conditional class is not updated.

Example component:

<template>
        <q-input outlined bg-color="red" label="test" :class="$q.screen.gt.xs ? '' : 'fit'"/>
</template>

<script lang="ts">
import { defineComponent } from 'vue'

export default defineComponent({
  created() {
    console.log(this.$q.screen.gt.xs);
  },
  mounted() {
    console.log(this.$q.screen.gt.xs);
  },
})
</script>

Upon initial load this input field will still have the fit class applied to it until you interact with the input.

Codepen/jsFiddle/Codesandbox (required) There is no Codesandbox available yet for SSR in Quasar v2.

To Reproduce Steps to reproduce the behavior:

  1. Create new quasarv2 project
  2. Add the a component AsyncComp.vue to the components file with the content above.
  3. Add AsyncComp: defineAsyncComponent(() => import('src/components/AsyncComp.vue')) to Index.vue’s components declaration. Also add import {defineAsyncComponent} from 'vue' to this file.
  4. Add the <async-comp/> somewhere in the html.
  5. Run with SSR mode quasar dev -m ssr
  6. F5 on the index page and see.

Expected behavior Upon hydration the $q.screen.something should be reactive and the conditional class updated. At the mounted() hook this property already has the correct value, I don’t know why it won’t update.

Screenshots If applicable, add screenshots to help explain your problem.

Platform (please complete the following information): Quasar Version: v2.0.0-rc.3 @quasar/app Version: v3.0.0-rc.3 Quasar mode:

  • SPA
  • SSR
  • PWA
  • Electron
  • Cordova
  • Capacitor
  • BEX

Tested on:

  • SPA
  • SSR
  • PWA
  • Electron
  • Cordova
  • Capacitor
  • BEX

OS: Node: NPM: Yarn: Browsers: iOS: Android: Electron:

Additional context Add any other context about the problem here.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
pdanpdancommented, Jul 6, 2022
0reactions
JeRabixcommented, Jul 6, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing Universal Code - Quasar Framework
This means data reactivity is unnecessary on the server, so it is disabled by default. Disabling data reactivity also avoids the performance cost...
Read more >
React Server Side Code Splitting Made.. Again - ITNEXT
React code splitting became a thing a year ago. Since then, we are finding new ways to codesplit and defer component rendering. Let's...
Read more >
React SSR - Rendering a component following an async action
How do I render a component following an async action on the server side when using server rendering? My code so far: import...
Read more >
SolidJS - a first look
That's why we see all the SSR frameworks such as SvelteKit, Next, ... That doesn't apply if your app has many components, but...
Read more >
Web on Servlet Stack - Spring
From a programming model perspective, both Spring MVC and Spring WebFlux support asynchronous and Reactive Types as return values in controller methods. Spring ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found