RDFLib / prez-ui

BSD 3-Clause "New" or "Revised" License
10 stars 7 forks source link

MainNav.vue reads props before props is declared #162

Closed ashleysommer closed 5 months ago

ashleysommer commented 5 months ago

Issue is here: https://github.com/RDFLib/prez-ui/blame/067ab411c04ef9e58ea49b66b96a29ed430c4800/src/components/navs/MainNav.vue#L75

variable props isn't defined until line 83.

Running Prez-UI out of the box throws this error for me:

can't access lexical declaration 'props' before initialization

This bug has been in the codebase since 5th June 2023, not sure how how the code works fine for other users. Perhaps its a recent change in vue.js or a change in browser behavior that treats this as an unrecoverable error now, but was glossed over in the past.

ashleysommer commented 5 months ago

Note, when re-testing this with Vue v3.3.4 (as locked in the package-lock.json lockfile) this bug cannot be reproduced. However when installing the latest Vue as-per the version pattern in package.json (it installs v3.4.30) then it exposes this bug. Seems like the newer version is more susceptible to this use-before-declare JS bug, I can't tell which version of Vue changed this behaviour.

So options would be to change the package.json file to use ~3.3.0 instead of the current pattern ^3.3.0 so it will not use the new version of Vue, or simply fix the underlying JS variable ordering issue as per #164.