canjs / can-route

Observable front-end application routing for CanJS.
https://canjs.com/doc/can-route.html
MIT License
10 stars 4 forks source link

Setting a route property to an empty string breaks route matching #186

Open phillipskevin opened 6 years ago

phillipskevin commented 6 years ago

With routes defined like:

can.route.register("{page}", { page: "home" });
can.route.register("{page}/{section}");

Setting section to "" (empty string), breaks route matching.

In 3.0, doing this would give this data

route.data.page; // -> "home"
route.data.section; //-> ""
route.matched(); //-> "{page}"

...in 4.0, it gives:

route.data.page; // -> ""
route.data.section; //-> ""
route.currentRule(); //-> ""

See: https://jsbin.com/janipazeme/1/edit?js,output.

phillipskevin commented 6 years ago

This is caused by https://github.com/canjs/can-route-hash/issues/3.

phillipskevin commented 6 years ago

After fixing https://github.com/canjs/can-route-hash/issues/3, we also need to figure out how param/deparam should work with null/undefined/""/0/false values.