Skip to content

Bug: route with optional params don't work anymore— MicroRouter regression vs page.js bug #130

@peernohell

Description

@peernohell

Environment
Package: ostrio:[email protected] (also reproducible on 3.14.x)
Internal router: MicroRouter (introduced in 3.14, replacing page.js)
Browser: any (Chromium / Firefox), checked on macOS
Meteor: 3.4.x (irrelevant to the bug, but for context)

FlowRouter.route(`/test/:_id?`, { name: 'testName', title: 'test test', action() { } });

// before
FlowRouter.go('testName');
FlowRouter.getRouteName() // => 'testName'

// after
FlowRouter.go('testName');
FlowRouter.getRouteName() // => undefined

After investigating we found that microRouter handle differently the path depending an ending '/' in the path.

FlowRouter._microRouter.show('/test/'); // working
FlowRouter._microRouter.show('/test'); // not working

FlowRouter.path always remove trailling '/' in the end of path in case of optional parameters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions