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
    1. Home
    2. bago
    B
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 6
    • Best 2
    • Groups 0

    bago

    @bago

    3
    Reputation
    2
    Profile views
    6
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    bago Follow

    Best posts made by bago

    • RE: QDrawer prop: show-if-above

      I tried the s.molinari solution but still didn’t work.
      I had to explicitly add behavior=“desktop” with :show-if-above=“false” to get it work properly.

      q-drawer(
            v-model="drawer"
            side="right"
            behavior="desktop"
            :show-if-above="false"
            bordered
          )
      

      Hope that will save people time !

      Bago…

      posted in Framework
      B
      bago
    • RE: QDrawer prop: show-if-above

      @deadly Yeah I know, we should contact the dev team to address the issue properly but I had no time so far to do it.
      Will open an issue on their gitHub when I will have time. Meantime, I’m glad I saved your time ;).

      posted in Framework
      B
      bago

    Latest posts made by bago

    • RE: How to trigger the dialog onOk button ( jest unit test )

      Hey guys, stumbled upon that issue today. This is how I managed to do it.
      Suppose you call the dialog like this in you vue

      // draft.vue
      this.$q.dialog({
        title: this.$t('mixin.delete.title'),
        message: this.$t('mixin.delete.confirmation'),
        cancel: true,
        persistent: true
      }).onOk(() => {
        this.deleteDraftLifts()
      })
      

      You can trigger the onOk callback in two times by using the mockReturnThis() function of jest. The trick is to understand that we are tying to mock chained functions (this.$q.dialog({...}).onOk())

      So start by mocking this.$q.dialog({...}) with

      // draft.spec.js
      vm.$q.dialog = jest.fn().mockReturnThis()
      

      then mock the onOK like this

      // draft.spec.js
      vm.$q.dialog().onOk = jest.fn()
      

      now you can trigger your function and it will pass.

      // draft.spec.js
      wrapper.find('xxxx-class' ).trigger('click') 
      expect(vm.$q.dialog().onOk).toHaveBeenCalled()
      

      You can go further by checking the delete logic inside if you want. You will need to abstract the logic inside a function like I did in my example draft.vue withthis.deleteDraftLifts()
      by doing this you can now write the following code

      // draft.spec.js
      vm.$q.dialog = jest.fn().mockReturnThis()
      vm.$q.dialog().onOk = jest.fn(() => vm.deleteDraftLifts())
      
      wrapper.find('xxxx-class' ).trigger('click') 
      expect(vm.$q.dialog().onOk).toHaveBeenCalled()
      
      posted in Help
      B
      bago
    • RE: Pass parameters to @filter in q-select

      @metalsadman Excellent ! Exactly what I was looking for.
      Thanks a lot !

      Bago…

      posted in Framework
      B
      bago
    • Pass parameters to @filter in q-select

      q-select has the method @filter with 3 options (val, update, abort).
      I need to pass extra parameters to the function but it looks like it’s impossible because the function accept only

      @filter="FilterFn"
      

      I need something like

      @filter="FilterFn('tokyo')"
      

      And later access params like

      FilterFn ({ val, update, abort }, { params }) {
        console.log(params) // 'tokyo'  
      }
      

      Bago…

      posted in Framework
      B
      bago
    • RE: QDrawer prop: show-if-above

      @deadly Yeah I know, we should contact the dev team to address the issue properly but I had no time so far to do it.
      Will open an issue on their gitHub when I will have time. Meantime, I’m glad I saved your time ;).

      posted in Framework
      B
      bago
    • ssrContext and cookies set from server side

      Hello everybody,

      I’ve been working on my app and I have a question about the ssrContext in quasar.

      The context:

      I’m using Quasar SSR (isomorphic mode) to communicate with a BFF build on my own.
      After login (by using a fetch request with credential=include, mode=cors), my BFF set cross site server side cookies (with httpOnly=true, secure=true and SameSite=None).

      The problem:

      When I use the client side (created or mounted), everything work fine,
      I receive the cookies back from the server and they got store so that cookies are include in the next request to the server.

      But when I’m using the server side (preFetch), according to this

      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 what I understand is that I’m on a fresh instance, so probably a fresh request as well
      (which means a different one from the client side).
      Thus, when I send a request from the ssrContex (preFetch), since it’s a fresh instance, my BFF must also set cookie for the ssrContext right ?

      Well, although I send a request from the ssrContext (via ssrContext.req), it looks like no cookie get set in ssrContext.res, causing my next request to be sent without any cookie.
      Is that an excepted behavior ? If yes why can’t we set cookies when a request is sent from ssrContext ?

      Regards,

      posted in Help
      B
      bago
    • RE: QDrawer prop: show-if-above

      I tried the s.molinari solution but still didn’t work.
      I had to explicitly add behavior=“desktop” with :show-if-above=“false” to get it work properly.

      q-drawer(
            v-model="drawer"
            side="right"
            behavior="desktop"
            :show-if-above="false"
            bordered
          )
      

      Hope that will save people time !

      Bago…

      posted in Framework
      B
      bago