mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 10:25:06 +03:00
## Summary Fixes several high-impact Sentry errors reported in production. ### Fixed Issues - **[SUPABASE-APP-EJ3](https://supabase.sentry.io/issues/7356937474/)** — `TypeError: Cannot read properties of undefined (reading 'direct')`. `connectionStringPooler` could be `undefined` when the connection source doesn't match any key in the connection strings map. Added an early return guard in `resolveConnectionString`. - **[SUPABASE-APP-B17](https://supabase.sentry.io/issues/7117468199/)** — `RangeError: Invalid time zone specified: Etc/Unknown`. `dayjs.tz.guess()` returns `"Etc/Unknown"` for some users with misconfigured browser/OS timezones. Added a shared `guessLocalTimezone()` helper that validates the guessed timezone via `Intl.DateTimeFormat` and falls back to UTC. Applied across all 4 call sites. - **[SUPABASE-APP-BCM](https://supabase.sentry.io/issues/7192934901/)** — `TypeError: Cannot convert undefined or null to object`. `Object.entries(definition.properties)` crashed when a JSON schema definition existed but had no `properties` field. Updated the guard to check `definition?.properties` instead of just `definition`. - https://supabase.sentry.io/issues/7357780302/?project=5459134 - https://supabase.sentry.io/issues/7358344652/?project=5459134 - https://supabase.sentry.io/issues/7096737077/?project=5459134 ## Test plan - [ ] Verify connect dialog renders without errors when connection data is still loading - [ ] Verify API docs Entity view handles schema definitions without properties - [ ] Verify charts/tooltips display correct timezone labels --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
37 lines
1.5 KiB
TypeScript
37 lines
1.5 KiB
TypeScript
import dayjs from 'dayjs'
|
|
import { guessLocalTimezone } from 'lib/dayjs'
|
|
import type { TooltipProps } from 'recharts'
|
|
import { formatDuration } from '../QueryInsightsTable/QueryInsightsTable.utils'
|
|
import { isTimeMetric } from './QueryInsightsChart.utils'
|
|
|
|
export const QueryInsightsChartTooltip = ({ active, payload }: TooltipProps<number, string>) => {
|
|
if (!active || !payload?.length) return null
|
|
|
|
const time = payload[0]?.payload?.time
|
|
const localTimeZone = guessLocalTimezone()
|
|
|
|
return (
|
|
<div className="grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg px-2.5 py-1.5 text-xs shadow-xl">
|
|
<p className="text-foreground-light text-xs">{localTimeZone}</p>
|
|
<p className="font-medium">{dayjs(time).format('MMM D, hh:mm:ssa')}</p>
|
|
<div className="grid gap-0">
|
|
{payload.map((entry, index) => (
|
|
<div key={`${entry.name}-${index}`} className="flex items-center w-full">
|
|
<svg width="10" height="10" viewBox="0 0 10 10" fill="none">
|
|
<circle cx="5" cy="5" r="3" fill={entry.color} />
|
|
</svg>
|
|
<span className="text-foreground-lighter ml-1 flex-grow">{entry.name}</span>
|
|
<span className="ml-3.5">
|
|
{typeof entry.value === 'number'
|
|
? isTimeMetric(typeof entry.dataKey === 'string' ? entry.dataKey : '')
|
|
? formatDuration(entry.value)
|
|
: entry.value.toLocaleString()
|
|
: entry.value}
|
|
</span>
|
|
</div>
|
|
))}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|