[SOLVED] Router weird error



  • I try to explain more easily I can.

    • I have a component list, which is loaded when router goes on 'companies' route.
    • I open a modal (which is another component) and create a new company.
    • This modal emit an event catched to its father (the companies list component) named 'save', adding a parameter which is the id of the company created.
    • In the father component I catch the save event and I push the route of the new company in order to edit it:
      this.$router.push('companies/' + id)

    First time it works, but when I go back to list and create another company it fails with that error in console:

    Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.

    To go back I use this.$router.back()

    EDIT: Same issue if I go back to companies using this.$route.push('\companies')

    Anyone can help me? It seems an error generated by quasar.common.js. Full error stack is:

    quasar.common.js?e3df:350 Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not
    of type 'Element'.
        at Object.width (eval at <anonymous> (app.js:1625), <anonymous>:350:28)
        at VueComponent.__redraw (eval at <anonymous> (app.js:1625), <anonymous>:7839:21)
        at VueComponent.boundFn (eval at <anonymous> (app.js:808), <anonymous>:166:12)
        at later (eval at <anonymous> (app.js:1625), <anonymous>:291:21)
    

  • Admin

    Any repo I can take a look? Need specifics to see what’s going on.



  • @rstoenescu Sorry, due to business limitation I cannot release the code publicly.
    I will try to get you the repo as soon as I can, maybe I give you a bitbucket user.

    See you soon, thanks for now.



  • @rstoenescu I found out a thing.
    The error I write above it’s thrown if I use the hole component Company, with child components, etc.
    If I clean out Company component, instead, it does not throw anything. Just redirect on Company List page without say a word in the console.
    So it seems the error depends on something else.

    I try investigate a bit more deeply, but I fear I’ll never figure it out.



  • Hi @rstoenescu, it’s always me.

    I figured out how to replicate the error in a simple project, that I could push on a git repo.
    Here’s the link: https://github.com/ntaddei/router-test

    In order to replicate the error:

    1. Go on ‘companies’ menu voice, it’ll load Companies component.
    2. Add new Company, insert name/motto (just for fun) and click CREATE button. It will add a new Company and go to Company profile (‘companies/:id’)
    3. Go back (browser button works as well)
    4. Add another Company
    5. You’ll see this time it goes on Company profile then immediately back to companies list.

    Hope it’s enough, if you’ll find out what’s going on I’ll really appreciate that.
    Thank you very much!

    Niccolò



  • @n.taddei I’ve been trying find out what is causing that to happen for the past 25 minutes. It’s going to be really rewarding when found.

    EDIT: So if you comment out this.$refs.modal.close() in CompanyCreate.vue:61 the problem goes away (at least on quasar v0.13.9). I’ve submitted a PR to the repo.



  • It works!! Also on the original project!!
    Thank you very much @JCharante !!!


Log in to reply
 

Looks like your connection to Quasar Framework was lost, please wait while we try to reconnect.