Fix some voice room bugs

This commit is contained in:
Jon Staab
2026-05-28 12:17:17 -07:00
parent 2f8861be62
commit 045d6983dc
3 changed files with 107 additions and 23 deletions
+4 -1
View File
@@ -44,7 +44,10 @@ export const createScroller = ({
: element.closest(".scroll-container")
const check = async () => {
if (container) {
const isHidden = (el: Element) =>
(el as HTMLElement).offsetParent === null || el.clientHeight === 0
if (container && !isHidden(container)) {
// While we have empty space, fill it
const {scrollY, innerHeight} = window
const {scrollHeight, scrollTop, clientHeight} = container
+9 -5
View File
@@ -44,11 +44,15 @@ export const whenAborted = (signal?: AbortSignal) => {
})
}
/** Returns a promise that rejects with TimeoutError after ms. Use with Promise.race. */
export const whenTimeout = (ms: number, opts: {message?: string} = {}) => {
return new Promise<never>((_, reject) =>
setTimeout(() => reject(new TimeoutError(opts.message)), ms),
)
/**
* Returns a promise that rejects with TimeoutError after ms. Use with Promise.race.
* Pass an optional signal to clear the timer when that signal aborts (self-cleaning).
*/
export const whenTimeout = (ms: number, opts: {message?: string; signal?: AbortSignal} = {}) => {
return new Promise<never>((_, reject) => {
const timeout = setTimeout(() => reject(new TimeoutError(opts.message)), ms)
opts.signal?.addEventListener("abort", () => clearTimeout(timeout), {once: true})
})
}
export const buildUrl = (base: string | URL, ...pathname: string[]) => {