more testing
Build and Publish / Metadata (push) Successful in 2s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 1m0s

This commit is contained in:
mats committed 2026-09-19 16:44:51 +02:00
1 parent 1aa264675e
commit 2da2649a2f
11 files changed
+293 -51

No files matched your search

@@ -2,7 +2,7 @@
import { useState, useEffect, useRef, useMemo, useCallback, type ReactNode } from "react"
import { useLocation } from "wouter"
import { tabForPath, pathForTab } from "../lib/routes"
import { tabForPath, pathForTab, splitPath, joinPath } from "../lib/routes"
import type {
MetricData,
OtelHistoryMessage,
@@ -150,11 +150,31 @@ export function ObservabilityProvider({
const setActiveTabWithRoute = useCallback(
(tab: string) => {
setActiveTab(tab)
// Already inside this tab (possibly on a deep link): keep the sub-route.
if (tabForPath(window.location.pathname) === tab) return
const path = pathForTab(tab)
if (path && path !== window.location.pathname) navigate(path)
if (path) navigate(path)
},
[navigate],
)
// Trace selection <-> /traces/<traceId>[/<spanId>]. The URL is adopted when
// it names a trace; a bare /traces never clears the selection, because other
// views set the trace first and switch tabs second.
useEffect(() => {
const { base, rest } = splitPath(location)
if (base !== "/traces" || !rest[0]) return
setActiveTraceId((prev) => (prev === rest[0] ? prev : rest[0]))
setActiveSpanId((prev) => (prev === (rest[1] ?? null) ? prev : (rest[1] ?? null)))
// eslint-disable-next-line react-hooks/exhaustive-deps -- only follow URL changes
}, [location])
useEffect(() => {
if (activeTab !== "tab1" || !activeTraceId) return
const target = joinPath("/traces", activeSpanId ? [activeTraceId, activeSpanId] : [activeTraceId])
if (target !== window.location.pathname) navigate(target)
// eslint-disable-next-line react-hooks/exhaustive-deps -- location is read imperatively
}, [activeTab, activeTraceId, activeSpanId, navigate])
const [filtersExpanded, setFiltersExpanded] = useState<boolean>(false)
// Trace ids we already have spans for, so selecting a trace that fell
// outside the initial history window (or arrived before this session