navi
navi copied to clipboard
Crawl fails for non-redirect matchers (matcher is not a function)
crawl
doesn't work on certain older browsers and throws TypeError: matcher is not a function
.
The problem seems to be caused by the returned promise from createCrawlTuplesPromise
that resolves to incorrect data types. The resolved value is expected to be an array where the items is a tuple containing one function and one object, but is rather one string and one object.
Here is an example where the promise resolves incorrectly (on Chromium v 65.0.3325). Notice the string type in the first item of the result, starting from index 13:
Here's an example where the promise resolves correctly (latest Chromium):
Here is the result of the paths-variable within the createCrawlTuplesPromise
. I suspect the problem is within this function.
redirect
matchers are resolved correctly but withView
and mount
matchers do not. I've debugged and went through the code but I'm having a hard time understanding the data flow and generators. Any idea what may be the cause?
Thanks for brining this up! What a bizarre bug.
Any chance you could quickly run Object.entries({})
in the version of chrome that this is failing on, and see if it works?
Yes, of course. It seems to generate the expected result:
Chromium 65:
Chromium 75:
I also ran the code in our webapp with the same result. I did that to cover the case where some polyfill could be messing with Object.entries
.