justinwhite.work

Prerendered Shells & SWR Surfaces

Modern work software often suffers from a latency problem disguised as a framework problem. Sherbet combines Astro static prerendering with a custom Stale-While-Revalidate Surface compositor to make complex views feel instantaneous.

by Justin White6 min read
Vol. I, No. TwoReleased November 2026

Most project management tools ship as massive single-page applications that download megabytes of JavaScript, boot a client router, and block on a cascade of network requests before drawing a sidebar or a ticket list.

With Sherbet, we wanted the tactile speed of a native desktop utility inside the browser. Achieving that required splitting the frontend architecture into two distinct layers: Astro to prerender the vast majority of the application UI ahead of time, and a custom Surface Compositor to manage progressive hydration, Stale-While-Revalidate (SWR) caching, and optimistic mutations inside interactive views.

Prerendering the Application Shell with Astro

Even in a dense issue tracker or customer support inbox, most of the pixels on screen are structural: navigation rails, top bars, layout chrome, typography, and view containers.

Rather than rendering the entire application inside a single client-side React root, Sherbet serves all of its product areas through a unified Astro frontend:

  • Zero-JS Structural Chrome: Page shells, sidebars, and static layouts are prerendered into lightweight HTML and CSS at build time. The browser paints the workspace frame immediately on navigation without waiting for JavaScript bundle evaluation.
  • Scoped Interactive Islands: Client-side hydration is reserved strictly for high-density work surfaces such as Kanban boards, split-pane inbox explorers, and inspector drawers.

The Surface Compositor Architecture

Inside those interactive islands, naive data fetching still creates visual jitter if every card, row, and drawer manages its own network lifecycle independently. To solve this, we built the Surface system: a scoped runtime boundary, multi-tier cache engine, and state container that wraps interactive views.

Every Surface boundary is configured across four independent dimensions:

  • Fetch Timing: Controls whether data requests fire eagerly on mount, defer to the browser's idle callback so animations and input handlers never drop frames, or wait lazily for explicit user interaction.
  • Cache Policy: Governs how local cache and remote endpoints negotiate state across cache-only, cache-first, network-only, and stale-while-revalidate strategies.
  • Storage Persistence: Syncs in-memory entity state with session or local storage so workspace views survive reloads and tab switches intact.
  • Diagnostics: Emits granular cache-hit, deduplication, and wire telemetry during development.

Eliminating Spinners with SWR and URL Precaching

Most interactive views in Sherbet run on a deferred Stale-While-Revalidate preset. When an issue card or inbox pane requests an entity, resolution follows a strict fast path:

  • Immediate Cache Hydration: The Surface checks its in-memory store and session storage first. On a hit, the component renders the cached state immediately with zero loading spinners while revalidating silently in the background.
  • In-Flight Deduplication: When background revalidation fires, an internal promise pool deduplicates concurrent requests. If ten components on screen reference the same issue or team member simultaneously, only a single network call crosses the wire.
  • Clickable Skeletons via URL Precaching: On a cold cache miss, containment queries pre-populate a synchronous URL cache with every child issue's canonical route before full payloads arrive. Even unhydrated skeleton cards render inside live anchor tags, allowing engineers to hover, middle-click into new tabs, or navigate immediately without waiting for hydration.

Zero-Latency Optimistic Mutations

When an engineer drags a card across Kanban columns or updates priority in a split pane, waiting on a server round-trip breaks momentum.

Mutations in a Surface execute in two phases. First, the local state store updates on the very next frame and notifies only the components subscribed to that specific entity ID. Second, the mutation synchronizes with our

edge primitives
in the background, committing to persistent storage on success or rolling back automatically if the network request fails.