Bug bash 2026-09-19: 17 bugs fixed and verified (BUGS.md)
Widgets: a bad pattern no longer silences every widget; malformed layouts load. Shell: lost session returns to login at once; tab titles; Escape closes menus and dialogs. Files: names are one path segment; unsaved edits ask before page/machine/tab changes; only folders that opened are remembered. Terminals: unique default names; 64-char names. API: queries capped at 10 000 values; 32 streams per client, 512 in all; only /embed/widget is frameable. ZFS sensors: one unprivileged zpool list, no sudo journal spam. Phone: 36 px inputs; dataset rows as wide as their cells. Machines: valid name pattern. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
36de4ad4a1
commit
8ee2a2d293
+20
-1
@@ -1,4 +1,4 @@
|
||||
import { ReactNode, useEffect, useState } from 'react'
|
||||
import { ReactNode, useEffect, useRef, useState } from 'react'
|
||||
|
||||
// ---- spinners ----
|
||||
export function Spinner({ size = 14 }: { size?: number }) {
|
||||
@@ -68,3 +68,22 @@ export function NetBar() {
|
||||
}, [])
|
||||
return <div className={'netbar' + (n > 0 ? ' on' : '')} />
|
||||
}
|
||||
|
||||
// useEscape runs fn when Escape is pressed while active — every menu and dialog closes that way.
|
||||
export function useEscape(fn: () => void, active = true) {
|
||||
const ref = useRef(fn); ref.current = fn
|
||||
useEffect(() => {
|
||||
if (!active) return
|
||||
const h = (e: KeyboardEvent) => { if (e.key === 'Escape') ref.current() }
|
||||
window.addEventListener('keydown', h)
|
||||
return () => window.removeEventListener('keydown', h)
|
||||
}, [active])
|
||||
}
|
||||
|
||||
// Unsaved work: whoever holds some says so, and whoever is about to navigate away asks.
|
||||
let unsaved = ''
|
||||
export function setUnsaved(what: string) { unsaved = what }
|
||||
export function okToLeave(): boolean {
|
||||
if (!unsaved || window.confirm(`Discard unsaved changes to ${unsaved}?`)) { unsaved = ''; return true }
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user