refactor(studio): drop the bespoke user-filter notice

Remove the persistent Admonition (and its now-orphaned UserLogFilterNotice
component + useResolvedLogUser hook). The user filter now behaves like any
other Unified Logs filter — an empty result renders the standard empty state,
no special-cased banner.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
kemalandClaude Opus 4.8 committed 2026-07-09 12:40:36 +01:00
1 parent 3b5b465978
commit 699892eeb7
3 files changed
-116

No files matched your search

@@ -33,7 +33,6 @@ import { DownloadLogsButton } from './components/DownloadLogsButton'
import { LogsFilterBar } from './components/LogsFilterBar'
import { LogsListPanel } from './components/LogsListPanel'
import { TooltipLabel } from './components/TooltipLabel'
import { UserLogFilterNotice } from './components/UserLogFilterNotice'
import { RowSelectionHeader } from './RowSelectionHeader'
import { ServiceFlowPanel } from './ServiceFlowPanel'
import { SEARCH_PARAMS_PARSER } from './UnifiedLogs.constants'
@@ -441,15 +440,6 @@ export const UnifiedLogs = () => {
)}
</div>
{search.user ? (
<UserLogFilterNotice
className="mx-2 mt-2"
identifier={search.user}
isEmpty={!isLoading && !isFetching && filterDBRowCount === 0}
onClear={() => setSearch({ user: null })}
/>
) : null}
<RowSelectionHeader />
<ResizablePanelGroup
@@ -1,57 +0,0 @@
import { Button } from 'ui'
import { Admonition } from 'ui-patterns/admonition'
import { useResolvedLogUser } from '../hooks/useResolvedLogUser'
interface UserLogFilterNoticeProps {
/** The active `?user=` identifier. */
identifier: string
/** True once loading has settled and no rows are attributable to this user. */
isEmpty: boolean
onClear: () => void
className?: string
}
/**
* Persistent notice shown while the user filter is active. Honesty requirement: it
* always states that coverage is partial (some sources can't be attributed and are
* hidden), and on an empty result it surfaces the likely cause — auth event logs not
* being enabled — as a system condition rather than reading as "no such user".
*/
export const UserLogFilterNotice = ({
identifier,
isEmpty,
onClear,
className,
}: UserLogFilterNoticeProps) => {
const { data: resolved } = useResolvedLogUser(identifier)
const label = resolved?.email ?? identifier
const clearAction = (
<Button type="button" variant="default" size="tiny" onClick={onClear}>
Clear
</Button>
)
if (isEmpty) {
return (
<Admonition
type="warning"
className={className}
title={`No logs attributable to ${label} in the selected time range`}
description="Auth event logs may not be enabled for this project. Some log sources also can't be filtered by user and are hidden."
actions={clearAction}
/>
)
}
return (
<Admonition
type="default"
className={className}
title={`Showing logs attributable to ${label}`}
description="Some sources can't be filtered by user and are hidden."
actions={clearAction}
/>
)
}
@@ -1,49 +0,0 @@
import { useQuery } from '@tanstack/react-query'
import { useParams } from 'common'
import {
searchAuthUserByEmail,
searchAuthUserById,
} from '@/components/interfaces/UserJourneys/UserJourneys.queries'
import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
import { UUID_REGEX } from '@/lib/constants'
export interface ResolvedLogUser {
/** The raw identifier from the URL (id or email). */
identifier: string
/** Resolved email, if an auth.users row was found (or the identifier itself when it's an email). */
email: string | null
/** Resolved auth.users id, if one exists. Null for e.g. a failed signup with no row. */
userId: string | null
/** Whether an auth.users row matched. False is normal for failed signups. */
exists: boolean
}
/**
* Resolves a Unified Logs `?user=` identifier (email or id) into display info for the
* active-filter notice. Reuses the same identity-resolution queries the parked user-journey
* timeline depends on. Display-only — the log SQL matches the raw `?user=` value directly.
*/
export function useResolvedLogUser(identifier: string | null | undefined) {
const { ref: projectRef } = useParams()
const { data: project } = useSelectedProjectQuery()
const connectionString = project?.connectionString ?? null
const id = identifier?.trim() ?? ''
return useQuery<ResolvedLogUser | null>({
queryKey: ['unified-logs-resolve-user', projectRef, connectionString, id],
enabled: Boolean(projectRef) && id.length > 0,
staleTime: 5 * 60 * 1000,
queryFn: async () => {
const isId = UUID_REGEX.test(id)
const user = isId
? await searchAuthUserById(projectRef!, connectionString, id)
: await searchAuthUserByEmail(projectRef!, connectionString, id)
if (!user) {
return { identifier: id, email: isId ? null : id, userId: isId ? id : null, exists: false }
}
return { identifier: id, email: user.email, userId: user.id, exists: true }
},
})
}