navigate() returns TypeError when using RegExp as route path
See original GitHub issueI’ve been using Navigo for quite some time in a custom React wrapper. Until now, using RegExp as route path instead of strings worked perfectly. After upgrading from 7.1.2 to 8.8.0 this week, Navigo.navigate() however sometimes throws a TypeError exception
TypeError: t.replace is not a function. (In 't.replace(/\/+$/,"")', 't.replace' is undefined)
This happens, when a RegExp is provided to matchLocation() as first argument and this value is run through clean() function, which expects a String. Since replace() isn’t available on RegExp objects, the above exception is thrown.
Enclosing the same RegExp routes definitions in strings works without any problem.
It would also be great, if capture groups in RegExp route definitions would be evaluated and added to Match.data object.
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (7 by maintainers)
Top GitHub Comments
Thanks. I’ll invetstigate.
It seems indeed to be a problem with babel which I’ll have to investigate further.