Skip to content

Strict exit #41

@ramiel

Description

@ramiel

The exit handler is ambigous. Given the following routes

router
  .get('/posts/:page?', handler)
  .exit('/posts/:page?', exitHandler);

If I navigate from /posts/1 to /posts/2, should the exitHandler run?

The page is changing but the overall url structure is not.

A good solution can be to add a third parameter to .exit accepting options. One option can be strict and by default is false.

If false the behavior is that exit is run when the url changes, without any further check.
if true the exit handler run only if the next url is not a match for the exit path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions