Closed Javiani closed 5 years ago
Hi @Javiani, thanks! Could you give a code example of how you’re using Grapnel? Are you using Webpack or including it using <script>
tag?
Hi @baseprime !
I'm using Webpack, and the url is :
http://localhost:3000/playlists/#/advisor/clark-kent
I'm trying to get advisor name by using :
const router = new Grapnel()
router.get('/advisor/:analyst', console.log)
console.log
is not being called for that route.
It only works on 0.6 version.
Thanks!
Are you loading window
as an external in your webpack config?
Hi @baseprime , I tried to do that, but it still don't work.
One thing I notice is that the router.get('*')
works... I think it might be related to some async behavior on my application.
I think you can close this issue because I guess that I'm the only one that can reproduce this issue, so it's probably related to my implementation...
Thanks!
@Javiani @baseprime
I can confirm that this has become an issue in 0.7 -- 0.6.3 works fine.
We're using this lib in an old and very limited environment (Adobe Extension) which runs Chrome 41 and hence we rely on location.hash
.
Older version, when reading current path in hash mode, used to only return location.hash
. However, the new version returns entire location.pathname
.
Because Grapnel relies on this.path()
when parsing routes, and the Route
object receives the location.pathname
instead of location.hash
, it won't recognize any of your routes and it'll end up matching the wildcard 404
(if you have it defined).
@Javiani @meeh0w Wish we had caught this sooner. Thanks for your help!
I am still having this issue in version 0.7.2
Hi! First of all, keep up with this awesome library! I'm using as part of my own framework and its the best router I've ever found for javascript.
However, yesterday I have a little headache, I had to npm install it for a new project, but I got the 0.7 version which is not working as expected, I coudn't match any of my routes using
router.get()
( using hash ), before I go crazy I compared the new project to a older one then I realized that was a version issue. So I forced the npm version to 0.6 and it worked like a charm.I don't know if something changed and documentation is not updated or something like that, I'm just warning you that the library is currently broken in 0.7 version.
Bye! o/