formatLagDurationValue() — supabase Function Reference
Architecture documentation for the formatLagDurationValue() function in ReplicationPipelineStatus.utils.tsx from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD 6e775e06_d6b8_ba34_2d01_060326676b44["formatLagDurationValue()"] 7e53bba0_159c_a8c5_bd18_a1d72665e775["getFormattedLagValue()"] 7e53bba0_159c_a8c5_bd18_a1d72665e775 -->|calls| 6e775e06_d6b8_ba34_2d01_060326676b44 style 6e775e06_d6b8_ba34_2d01_060326676b44 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/studio/components/interfaces/Database/Replication/ReplicationPipelineStatus/ReplicationPipelineStatus.utils.tsx lines 149–186
const formatLagDurationValue = (value?: number) => {
if (typeof value !== 'number' || Number.isNaN(value)) {
return { display: '—', detail: undefined }
}
const sign = value < 0 ? '-' : ''
const absMilliseconds = Math.abs(value)
const duration = dayjs.duration(absMilliseconds, 'milliseconds')
if (absMilliseconds < 1000) {
return { display: `${value} ms`, detail: undefined }
}
const seconds = duration.asSeconds()
if (seconds < 60) {
const decimals = seconds >= 10 ? 1 : 2
return {
display: `${sign}${seconds.toFixed(decimals)} s`,
detail: `${numberFormatter.format(value)} ms`,
}
}
const minutes = duration.asMinutes()
if (minutes < 60) {
const roundedSeconds = Math.round(seconds)
return {
display: `${sign}${minutes.toFixed(minutes >= 10 ? 1 : 2)} min`,
detail: `${numberFormatter.format(roundedSeconds)} s`,
}
}
const hours = duration.asHours()
const roundedMinutes = Math.round(minutes)
return {
display: `${sign}${hours.toFixed(hours >= 10 ? 1 : 2)} h`,
detail: `${numberFormatter.format(roundedMinutes)} min`,
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does formatLagDurationValue() do?
formatLagDurationValue() is a function in the supabase codebase.
What calls formatLagDurationValue()?
formatLagDurationValue() is called by 1 function(s): getFormattedLagValue.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free