The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
sidebar url params passing fix
ddux1b11b1849b52
diff --git a/frontend/src/lib/components/app-sidebar.svelte b/frontend/src/lib/components/app-sidebar.svelteindex 540e9864..82ef76e1 100644--- a/frontend/src/lib/components/app-sidebar.svelte+++ b/frontend/src/lib/components/app-sidebar.svelte@@ -16,40 +16,45 @@{Icon: Link2, href: "/connection", title: "Connection"},]- // Build href with time range params preserved between metrics and transactions- function getHref(baseHref: string): string {+ // Reactive sidebar items with computed hrefs - explicitly read page.url to track dependency+ const sidebarItemsWithHref = $derived.by(() => {+ // Read page.url properties directly to establish reactive dependencyconst currentPath = page.url.pathname;+ const currentSearch = page.url.search;+ const preset = page.url.searchParams.get('preset');+ const from = page.url.searchParams.get('from');+ const to = page.url.searchParams.get('to');+ const servers = page.url.searchParams.get('servers');- // Only preserve params when navigating between time range pagesconst isCurrentTimeRangePage = timeRangePages.some(p => currentPath.startsWith(p));- const isTargetTimeRangePage = timeRangePages.includes(baseHref);- if (isCurrentTimeRangePage && isTargetTimeRangePage) {- // Preserve preset, from, to params- const params = new URLSearchParams();- const preset = page.url.searchParams.get('preset');- const from = page.url.searchParams.get('from');- const to = page.url.searchParams.get('to');+ return sidebarItems.map(item => {+ const isTargetTimeRangePage = timeRangePages.includes(item.href);- if (preset) {- params.set('preset', preset);- } else if (from && to) {- params.set('from', from);- params.set('to', to);- }+ let computedHref = item.href;- // Also preserve servers param for metrics page- if (baseHref === '/metrics') {- const servers = page.url.searchParams.get('servers');- if (servers) params.set('servers', servers);- }+ if (isCurrentTimeRangePage && isTargetTimeRangePage) {+ const params = new URLSearchParams();++ if (preset) {+ params.set('preset', preset);+ } else if (from && to) {+ params.set('from', from);+ params.set('to', to);+ }- const queryString = params.toString();- return queryString ? `${baseHref}?${queryString}` : baseHref;- }+ // Also preserve servers param for metrics page+ if (item.href === '/metrics' && servers) {+ params.set('servers', servers);+ }++ const queryString = params.toString();+ computedHref = queryString ? `${item.href}?${queryString}` : item.href;+ }- return baseHref;- }+ return { ...item, computedHref };+ });+ });</script>@@ -65,9 +70,9 @@<Sidebar.SidebarGroup><Sidebar.SidebarGroupContent><Sidebar.SidebarMenu>- {#each sidebarItems as sidebarItem}+ {#each sidebarItemsWithHref as sidebarItem}<Sidebar.SidebarMenuItem>- <a href={getHref(sidebarItem.href)}>+ <a href={sidebarItem.computedHref}><Sidebar.SidebarMenuButton isActive={page.url.pathname === sidebarItem.href || page.url.pathname.startsWith(sidebarItem.href + '/')}><sidebarItem.Icon /><span>{sidebarItem.title}</span>diff --git a/frontend/src/routes/metrics/+page.svelte b/frontend/src/routes/metrics/+page.svelteindex 0fbc720d..7585062e 100644--- a/frontend/src/routes/metrics/+page.svelte+++ b/frontend/src/routes/metrics/+page.svelte@@ -1,6 +1,7 @@<script lang="ts">import { onMount } from 'svelte';import { browser } from '$app/environment';+ import { goto } from '$app/navigation';import { Button } from '$lib/components/ui/button';import { RefreshCw, Code } from 'lucide-svelte';import ServerFilter from '$lib/components/dashboard/server-filter.svelte';@@ -140,7 +141,7 @@activeTab = initialUrlParams.tab;// Update URL with current state- function updateUrl(pushState = true) {+ function updateUrl(pushToHistory = true) {if (!browser) return;const params = new URLSearchParams();@@ -159,11 +160,11 @@const newUrl = `${window.location.pathname}?${params.toString()}`;- if (pushState) {- window.history.pushState({}, '', newUrl);- } else {- window.history.replaceState({}, '', newUrl);- }+ goto(newUrl, {+ replaceState: !pushToHistory,+ noScroll: true,+ keepFocus: true+ });}// Handle browser back/forward navigationdiff --git a/frontend/src/routes/transactions/+page.svelte b/frontend/src/routes/transactions/+page.svelteindex 12339bd6..fa413fdc 100644--- a/frontend/src/routes/transactions/+page.svelte+++ b/frontend/src/routes/transactions/+page.svelte@@ -1,6 +1,7 @@<script lang="ts">import { onMount, onDestroy } from 'svelte';import { browser } from '$app/environment';+ import { goto } from '$app/navigation';import { api } from '$lib/api';import { formatDuration, getNow, luxonToCalendarDateTime, parseISO, toUTCISO, calendarDateTimeToLuxon } from '$lib/utils/formatters';import { getTimezone } from '$lib/state/timezone.svelte';@@ -110,7 +111,7 @@let toTime = $state(dateToTimeString(initialRange.to));// Update URL with current time range- function updateUrl(pushState = true) {+ function updateUrl(pushToHistory = true) {if (!browser) return;const params = new URLSearchParams();@@ -124,11 +125,11 @@const newUrl = `${window.location.pathname}?${params.toString()}`;- if (pushState) {- window.history.pushState({}, '', newUrl);- } else {- window.history.replaceState({}, '', newUrl);- }+ goto(newUrl, {+ replaceState: !pushToHistory,+ noScroll: true,+ keepFocus: true+ });}// Handle browser back/forward navigation