Skip to content

Commit 335f09e

Browse files
committed
Preserve selected log from URL
1 parent bb0128b commit 335f09e

File tree

1 file changed

+7
-3
lines changed
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.logs

1 file changed

+7
-3
lines changed

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.logs/route.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,10 @@ function LogsList({
322322
const [nextCursor, setNextCursor] = useState<string | undefined>(list.pagination.next);
323323

324324
// Selected log state - managed locally to avoid triggering navigation
325-
const [selectedLogId, setSelectedLogId] = useState<string | undefined>();
325+
const [selectedLogId, setSelectedLogId] = useState<string | undefined>(() => {
326+
const params = new URLSearchParams(location.search);
327+
return params.get("log") ?? undefined;
328+
});
326329

327330
// Track which filter state (search params) the current fetcher request corresponds to
328331
const fetcherFilterStateRef = useRef<string>(location.search);
@@ -333,8 +336,9 @@ function LogsList({
333336
useEffect(() => {
334337
setAccumulatedLogs([]);
335338
setNextCursor(undefined);
336-
// Close side panel when filters change to avoid showing a log that's no longer visible
337-
setSelectedLogId(undefined);
339+
// Preserve log selection from URL param, clear if not present
340+
const params = new URLSearchParams(location.search);
341+
setSelectedLogId(params.get("log") ?? undefined);
338342
}, [location.search]);
339343

340344
// Populate accumulated logs when new data arrives

0 commit comments

Comments
 (0)