preactjs/preact-router

Star wildcard works only in last "path" segment

Open

#62 geöffnet am 17. Aug. 2016

Auf GitHub ansehen
 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (152 Forks)github user discovery
help wanted

Repository-Metriken

Stars
 (1.055 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

It seems that * wildcard works only in the end of path and when it used with some path-parameter.

For example url /post/123/comments matches to route /post/:id*. And matches.id == "123/comments"

But if we use * in the middle of query it does not work:

const App = () => (
  <div class="app">
    <Header />
    <Router>
      <Home path="/*/" />
      <Profile path="/*/profile/:user?" />
      <Error type="404" default />
    </Router>
  </div>
);
const Header = () => (
  <header>
    <nav>
      <a href="/appRoot/">Home</a>
      <a href="/appRoot/profile">Profile</a>
      <a href="/appRoot/profile/john">John</a>
      <a href="/appRoot/asdf">Error</a>
    </nav>
  </header>
);

This config always show "404" page. See JSFiddle

Contributor Guide