Files
rose-ash/sx/sx/data-test.sx
giles b0920a1121 Rename all 1,169 components to path-based names with namespace support
Component names now reflect filesystem location using / as path separator
and : as namespace separator for shared components:
  ~sx-header → ~layouts/header
  ~layout-app-body → ~shared:layout/app-body
  ~blog-admin-dashboard → ~admin/dashboard

209 files, 4,941 replacements across all services.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 22:00:12 +00:00

57 lines
3.1 KiB
Plaintext

;; Data test page — exercises Phase 4 client-side data rendering + caching.
;;
;; This page has a :data expression. When navigated to:
;; - Full page load: server evaluates data + renders content (normal path)
;; - Client route (1st): client fetches /sx/data/data-test, caches, renders
;; - Client route (2nd within 30s): client uses cached data, renders instantly
;;
;; Open browser console and look for:
;; "sx:route client+data" — cache miss, fetched from server
;; "sx:route client+cache" — cache hit, rendered from cached data
(defcomp ~data-test/content (&key (server-time :as string) (items :as list) (phase :as string) (transport :as string))
(div :class "space-y-8"
(div :class "border-b border-stone-200 pb-6"
(h1 :class "text-2xl font-bold text-stone-900" "Data Test")
(p :class "mt-2 text-stone-600"
"This page tests the Phase 4 data endpoint and client-side data cache. "
"The content you see was rendered using data from the server, but the "
"rendering itself may have happened client-side."))
;; Server-provided metadata
(div :class "rounded-lg border border-stone-200 bg-white p-6 space-y-3"
(h2 :class "text-lg font-semibold text-stone-800" "Data from server")
(dl :class "grid grid-cols-2 gap-2 text-sm"
(dt :class "font-medium text-stone-600" "Phase")
(dd :class "text-stone-900" phase)
(dt :class "font-medium text-stone-600" "Transport")
(dd :class "text-stone-900" transport)
(dt :class "font-medium text-stone-600" "Server time")
(dd :class "font-mono text-stone-900" server-time)))
;; Pipeline steps from data
(div :class "space-y-3"
(h2 :class "text-lg font-semibold text-stone-800" "Pipeline steps")
(div :class "space-y-2"
(map-indexed
(fn (i item)
(div :class "flex items-start gap-3 rounded border border-stone-100 bg-white p-3"
(span :class "flex-none rounded-full bg-violet-100 text-violet-700 w-6 h-6 flex items-center justify-center text-xs font-bold"
(str (+ i 1)))
(div
(div :class "font-medium text-stone-900" (get item "label"))
(div :class "text-sm text-stone-500" (get item "detail")))))
items)))
;; How to verify — updated with cache instructions
(div :class "rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm space-y-2"
(p :class "font-semibold text-amber-800" "How to verify client-side rendering + caching")
(ol :class "list-decimal list-inside text-amber-700 space-y-1"
(li "Open the browser console (F12)")
(li "Navigate to this page from another page using a link")
(li "Look for: " (code :class "bg-amber-100 px-1 rounded" "sx:route client+data /isomorphism/data-test"))
(li "Navigate away, then back within 30 seconds")
(li "Look for: " (code :class "bg-amber-100 px-1 rounded" "sx:route client+cache /isomorphism/data-test"))
(li "The server-time value should be the same (cached data)")
(li "Wait 30+ seconds, navigate back again — new fetch, updated time")))))