This commit is contained in:
cudr
2019-04-06 02:48:01 +03:00
parent 3a9d457389
commit 9e60a71cf5
2 changed files with 3 additions and 4 deletions

View File

@@ -104,14 +104,13 @@ export function select_target(url: URL): Target {
// avoid accidental clashes between server routes and page routes // avoid accidental clashes between server routes and page routes
if (ignore.some(pattern => pattern.test(path))) return; if (ignore.some(pattern => pattern.test(path))) return;
const query: Query = extract_query(url.search)
for (let i = 0; i < routes.length; i += 1) { for (let i = 0; i < routes.length; i += 1) {
const route = routes[i]; const route = routes[i];
const match = route.pattern.exec(path); const match = route.pattern.exec(path);
if (match) { if (match) {
const query: Query = extract_query(url.search);
const part = route.parts[route.parts.length - 1]; const part = route.parts[route.parts.length - 1];
const params = part.params ? part.params(match) : {}; const params = part.params ? part.params(match) : {};
@@ -141,7 +140,7 @@ export function handle_error(url: URL) {
segments: preloaded segments: preloaded
} }
const query = extract_query(search) const query = extract_query(search);
render(null, [], props, { path: pathname, query, params: {} }); render(null, [], props, { path: pathname, query, params: {} });
} }

View File

@@ -35,7 +35,7 @@ export default function start(opts: {
history.replaceState({ id: uid }, '', href); history.replaceState({ id: uid }, '', href);
const url = new URL(location.href) const url = new URL(location.href);
if (initial_data.error) return handle_error(url); if (initial_data.error) return handle_error(url);