No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Detecting "platform is desktop" does not seem to work with Firefox or Edge on SSR with PWA client takeover

    Help
    4
    9
    579
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jelices last edited by jelices

      Hello,

      This is my first post here so excuse if I may be missing something…

      I have a page with a typical layout that uses <q-toolbar> containing <q-btn @click="leftDrawerOpen = !leftDrawerOpen"> and then a <q-drawer v-model="leftDrawerOpen">.

      This is all in a .vue file. The data, as it is supposed to work with SSR looks like this:

      data() {
        return {
          leftDrawerOpen: this.$q.platform.is.desktop
        };
      }
      

      This way, the drawer will be open by default on any desktop platform. As I have tested, it does work with Chrome or Internet Explorer, but does not work with Firefox or Edge using SSR with PWA takeover (all under Windows.) While using quasar dev (so only PWA) it seems to work everywhere though.

      I have tried using !this.$q.platform.is.mobile or even this.$q.platform.is.desktop || this.$q.platform.is.firefox but it does not work. The drawer is closed for Firefox in this case.

      I have also tried delaying the platform detection and adding the initialization code inside mounted this way:

      mounted: function () {
        this.leftDrawerOpen = this.$q.platform.is.desktop
      }
      

      or even:

      mounted: function () {
        this.$nextTick(() => this.leftDrawerOpen = this.$q.platform.is.desktop)
      }
      

      But nothing works building with quasar build -m ssr.

      Does someone know whether this is a bug or am I doing something wrong?

      I am using the latest Quasar 1.0.4. This happens with previous versions as well but I have updated everything to make sure this is not something already fixed.

      Thank you!

      1 Reply Last reply Reply Quote 0
      • patryckx
        patryckx last edited by

        “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.”

        https://quasar.dev/quasar-cli/developing-ssr/ssr-frequently-asked-questions

        1 Reply Last reply Reply Quote 1
        • patryckx
          patryckx last edited by

          @jelices It is important that you read all the SSR documentation as it works differently from a SPA.

          https://quasar.dev/quasar-cli/developing-ssr/introduction

          1 Reply Last reply Reply Quote 1
          • J
            jelices last edited by

            Thank you for your responses!

            Sorry, I forgot to mention that this happens with SSR with PWA client takeover. My mistake. If I understand correctly, on the client side, the platform detection should work as a PWA. In fact, I have noticed that the Quasar Dev web site behaves differently depending on the browser. For instance, on my Windows PC, the page:

            https://quasar.dev/options/platform-detection#Usage

            Has the menu drawer open on a fresh load with Chrome, but closed with Firefox. I don’t know how it has been coded, but I am guessing that it is the same issue I am experiencing.

            1 Reply Last reply Reply Quote 0
            • J
              jelices last edited by

              Could someone with privileges please change the title to “on SSR with PWA client takeover”? Thank you!

              metalsadman 1 Reply Last reply Reply Quote 0
              • metalsadman
                metalsadman @jelices last edited by

                @jelices the author can change it i think.

                1 Reply Last reply Reply Quote 0
                • N
                  Nicholas last edited by

                  I have come across this bug too.

                  My layout drawer keeps closing whenever I enter the page on Firefox and Edge (I’m using a standard Quasar 1.0 SPA).
                  Works fine on Safari, Chrome.

                  metalsadman 1 Reply Last reply Reply Quote 0
                  • metalsadman
                    metalsadman @Nicholas last edited by metalsadman

                    @Nicholas i suggest opening a different thread, as this one was ssr/pwa issue.

                    1 Reply Last reply Reply Quote 0
                    • J
                      jelices last edited by

                      Edited the question. It is still unanswered. Thanks!

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post