swarm-ui: the refresh picker shows a spinner in place of its clock while its page is fetching
usePolled reports when a request is in flight (through a new onBusy of the poller) and holds it on for at least 0.4 seconds, so a quick answer still reads as a refresh. The picker swaps its clock for the spinner, in the same box so its width stays, and the spinner stands still where motion is off. Every page with a picker passes it; a page with several polled requests shows it while any of them runs. The Jobs page fetches through shared components and has none yet.
This commit is contained in:
parent
89bbeb9757
commit
47c447409b
1 changed files with 296 additions and 23 deletions
|
|
@ -96,9 +96,11 @@ function BuildsBody() {
|
|||
const wanted = wantedRun(useSearch());
|
||||
const [intervalMs, setIntervalMs] =
|
||||
useState<RefreshIntervalMs>(DEFAULT_INTERVAL_MS);
|
||||
const { data: runs, error } = usePolled(intervalMs, (signal) =>
|
||||
fetchJson<BuildRun[]>(RUNS, signal),
|
||||
);
|
||||
const {
|
||||
data: runs,
|
||||
error,
|
||||
refreshing,
|
||||
} = usePolled(intervalMs, (signal) => fetchJson<BuildRun[]>(RUNS, signal));
|
||||
// Which cards are open. Survives a refresh, so a list that updates under
|
||||
// you does not fold the card you are reading. A linked build starts open.
|
||||
const [open, setOpen] = useState<ReadonlySet<string>>(
|
||||
|
|
@ -134,6 +136,7 @@ function BuildsBody() {
|
|||
id="builds-refresh"
|
||||
value={intervalMs}
|
||||
onChange={setIntervalMs}
|
||||
refreshing={refreshing}
|
||||
/>
|
||||
</div>
|
||||
<p>
|
||||
|
|
|
|||
Loading…
Reference in a new issue