Skip to content

Commit dedaf60

Browse files
authored
fix(ui): non-destructive pending boundary — compact spinner, 333ms threshold (#841)
* fix(ui): non-destructive pending boundary — compact spinner, 333ms threshold * chore(lint): drop unused base58 import in near sandbox test
1 parent 4af6295 commit dedaf60

5 files changed

Lines changed: 19 additions & 12 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"everything-dev": patch
3+
---
4+
5+
De-scale the router's default pending boundary so navigations no longer blank the page: the default pending component renders a compact centered spinner instead of a full-viewport "Loading..." takeover, and `defaultPendingMs` moves from 100ms to 333ms so brief navigations keep the previous page visible with the root progress bar carrying the signal. Pairs with the login route rendering instantly from the hydrated session cache instead of blocking on a session fetch.

‎packages/better-near-auth/src/near.sandbox.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { base58, base64, hex } from "@scure/base";
1+
import { base64, hex } from "@scure/base";
22
import { getTestInstance } from "better-auth/test";
33
import { generateKey, MlDsa65KeyPair, Near } from "near-kit";
44
import { Sandbox } from "near-kit/sandbox";

‎packages/everything-dev/src/ui/router-client.tsx‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ export function createRouter<
6666
scrollRestoration: true,
6767
defaultStructuralSharing: true,
6868
defaultPreloadStaleTime: 0,
69-
// Show the pending boundary fast (#683): the router's 1000ms default left
70-
// cold authed navigations blank for up to a second, forcing every child
71-
// to re-declare pendingMs.
72-
defaultPendingMs: 100,
69+
// Pending boundary at 333ms: brief navigations keep the previous page
70+
// rendered with the root progress bar carrying the signal, and the
71+
// compact spinner is reserved for genuinely slow or first loads — still
72+
// well inside the 1000ms blank window #683 fixed.
73+
defaultPendingMs: 333,
7374
defaultPendingMinMs: 0,
7475
defaultErrorComponent: RouterError,
7576
defaultNotFoundComponent,

‎packages/everything-dev/src/ui/router-defaults.tsx‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ export function defaultNotFoundComponent() {
1919

2020
export function defaultPendingComponent() {
2121
return (
22-
<div className="min-h-screen flex items-center justify-center bg-background px-6">
23-
<div className="flex flex-col items-center gap-3" role="status" aria-live="polite">
24-
<div className="h-6 w-6 animate-spin rounded-full border-2 border-border border-t-foreground" />
25-
<p className="text-sm text-muted-foreground">Loading...</p>
26-
</div>
22+
<div
23+
className="flex min-h-48 flex-1 items-center justify-center bg-background p-6"
24+
role="status"
25+
aria-live="polite"
26+
>
27+
<div className="h-6 w-6 animate-spin rounded-full border-2 border-border border-t-foreground" />
2728
</div>
2829
);
2930
}

‎packages/everything-dev/src/ui/router-server.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ export function createServerRouterModule<TRouteTree extends AnyRoute = AnyRoute>
105105
},
106106
defaultNotFoundComponent,
107107
defaultPendingComponent,
108-
// Same fast-pending default as the client router (#683)
109-
defaultPendingMs: 100,
108+
// Same pending default as the client router
109+
defaultPendingMs: 333,
110110
defaultPendingMinMs: 0,
111111
dehydrate: () => {
112112
if (typeof window === "undefined") {

0 commit comments

Comments
 (0)