You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constpattern=newURLPattern({pathname: "/books{/:genre}?"});console.log(pattern.pathname)// PREVIOUSLY resulted in "/books{/:genre}?"console.log(pattern.pathname)// CURRENTLY results in "/books/:genre?"
// snippet from /src/router.tsif(part[j+1]==="["){// Disallow optional dynamic params like `foo-[[bar]]`if(part[j-1]!=="/"&&!!part[j-1]){thrownewSyntaxError(`Invalid route pattern: "${path}". An optional parameter needs to be a full segment.`,);}groupOpen++;optional=true;pattern+="{/";j++;}
Haven't exactly been able to figure out why, but I did notice that the test case for this pattern was recently removed from the deno repository.
I am assuming it simply didn't comply with the specification, but not completely sure. If you have some more insight into the why this URL pattern is no longer supported I'd love to know as I was using it too.
The text was updated successfully, but these errors were encountered:
There was a recent specification change in URLPattern, see whatwg/urlpattern#198 . It allows group values to be undefined instead of always falling back to an empty string.
Taking your pattern as an example: The genre group can now be undefined when passing http://example.com/books without a genre.
TLDR
Just wanted to give you a heads up on some additional
URLPattern
changes that impact the current router logic inside thepathToPattern
function.Haven't exactly been able to figure out why, but I did notice that the test case for this pattern was recently removed from the deno repository.
I am assuming it simply didn't comply with the specification, but not completely sure. If you have some more insight into the why this URL pattern is no longer supported I'd love to know as I was using it too.
The text was updated successfully, but these errors were encountered: