Issue with mutiple parameters in route

I upgraded my app to the latest bits, and I am now having an issue. If I have a router like this:

{ route: "organization/:organizationId/notes/:organizationNoteId?/edit", name: "organizationNoteEdit", moduleId: PLATFORM.moduleName("./routes/organization/organization-note-edit", "organization"), title: "Note", auth: true }

I get an error in the console that says:

TypeError: captures is null

If I change the route to:

{ route: "organization/:organizationId/notes/edit", name: "organizationNoteEdit", moduleId: PLATFORM.moduleName("./routes/organization/organization-note-edit", "organization"), title: "Note", auth: true }

It works. Changing it basically removes the parameter in the URL and puts it in as a query string.

Any idea why this no longer works properly?

Well, I have more information. I created a brand new project using the CLI (Webpack version). I then created two views and added this to the app.ts:

`import { autoinject, PLATFORM } from “aurelia-framework”;
import { Router, RouterConfiguration } from “aurelia-router”;

@autoinject
export class App {
constructor(private router: Router) {
}

configureRouter(config: RouterConfiguration, router: Router) {
	config.addAuthorizeStep(AuthenticateStep);
  
	config.map([
        { route: "", name: "home", moduleId: PLATFORM.moduleName("./level-one", "home"), title: "Level One" },
		{ route: "levelone/:id?/edit", name: "levelone", moduleId: PLATFORM.moduleName("./level-one", "home"), title: "Level One" },
        { route: "levelone/:id/leveltwo/:lid?/edit", name: "leveltwo", moduleId: PLATFORM.moduleName("./level-two", "home"), title: "Level Two" }
	]);
		
	this.router = router;
}

}`

If I remove the “/edit” from the first route, it works fine. Add it back and I get the error. This should not happen and never happened before I upgraded.

1 Like

Thanks for the information. I’ll take a look.

If you are able, please (a) submit an issue in https://github.com/aurelia/router and (b) create a repro (try using this as a starting point). In either case I’ll try to reproduce and fix this.

Can you please tell me what version of the following libraries you’re using:

router
templating-router
route-recognizer
history-browser

Thanks.

Just wondering if there are any recommended versions of the router that have been thoroughly tested with normal expected input. I tried upgrading the standard version but ran into incompatibility problems with some of the lower level npm packages. Clearly the compatibility flag system not working well…

router: 1.6.2
templating-router: 1.3.2
route-reconizer: 1.2.0
history-browser: 1.2.0