Closed mataslib closed 3 years ago
Hey, thanks for the detailed description and the repo to reproduce the bug, that's super helpful! I'll try this out in the next days.
I'll close #33 as it seems to be a duplicate.
Oops, closed the wrong issue, sorry...
Hey @mefechoel, thanks for your help and sorry for duplicate, I rly don't know how I managed to do that, heh.
This actually seems to be an issue with vite. Checkout this pr in svelte-routing for a workaround. I'll also add an explanation in the readme.
@mefechoel Thank you very much, this workaround works. 👍
Describe the bug A clear and concise description of what the bug is.
useLocation()
hook throws errorFunction called outside component initialization
.To Reproduce Steps to reproduce the behavior:
useLocation()
Please add a link to an example in the Svelte REPL or in a Codesandbox, if you can.
https://github.com/mataslib/uselocation-bug-repl
Expected behavior A clear and concise description of what you expected to happen.
Show route content.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.
Seems to not work only with Vite dev. It works with vite build, when u visit builded dist html. I used
useLocation()
before with rollup and it was working. Then I switched to vite for its speed and it also did work. Today, I was removing and updating npm deps and it stopped working with this error. Unfortunately I wasn't able to revert to working state and detect the culprit, so I made this clean repl.