fix(app): fix router lookup on search params

This commit is contained in:
Mathieu Schimmerling
2024-03-05 09:09:45 +01:00
parent cfff6a745b
commit e43f1aa18d
3 changed files with 11 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
<footer class="bg-gray-900 pb-20">
<h2 id="footer-heading" class="sr-only">Footer</h2>
<div class="mx-auto max-w-7xl px-6 pb-8 pt-16 sm:pt-24 lg:px-8 lg:pt-32">
<footer class="bg-gray-900">
<h2 class="sr-only">Footer</h2>
<div class="mx-auto max-w-7xl px-6 pb-20 pt-16 sm:pt-24 lg:px-8">
<div class="xl:grid xl:grid-cols-3 xl:gap-8">
<div class="space-y-8">
<a class="font-semibold text-xl flex items-center space-x-3" href="/">

View File

@@ -95,11 +95,11 @@
}
if (frameworkIdsSelectedOnInit.length === 0) {
const frameworkIdsFromStorage = frameworkIdsStorage.getJSON();
const frameworkIdsFromStorage = frameworkIdsStorage
.getJSON()
?.filter(matchFrameworkId);
if (frameworkIdsFromStorage?.length > 0) {
frameworkIdsSelectedOnInit = frameworkIdsFromStorage.map((x) =>
x === "svelte" ? "svelte4" : x
);
frameworkIdsSelectedOnInit = frameworkIdsFromStorage;
}
}

View File

@@ -17,7 +17,8 @@
const currentRoute = writable({ component: null });
function navigate(path) {
const routePayload = router.lookup(path);
const urlParsed = new URL(path);
const routePayload = router.lookup(urlParsed.pathname);
if (routePayload) {
if (routePayload.component.toString().startsWith("class")) {
currentRoute.set(routePayload);
@@ -36,7 +37,7 @@
}
window.onpopstate = () => {
navigate(window.location.pathname);
navigate(window.location.href);
};
function handleClick(event) {
@@ -53,7 +54,7 @@
onMount(() => {
document.addEventListener("click", handleClick);
navigate(window.location.pathname);
navigate(window.location.href);
});
onDestroy(() => {