Add suspense, resource, and transitions — Phase 2 complete
- suspense render-dom form: shows fallback while resource loads, swaps to body content when resource signal resolves - resource async signal: wraps promise into signal with loading/data/error dict, auto-transitions on resolve/reject via promise-then - transition: defers signal writes to requestIdleCallback, sets pending signal for UI feedback during expensive operations - Added schedule-idle, promise-then platform functions - All Phase 2 features now marked Done in status tables Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -438,3 +438,29 @@
|
||||
(fn (data) (reset! state (dict "loading" false "data" data "error" nil)))
|
||||
(fn (err) (reset! state (dict "loading" false "data" nil "error" err))))
|
||||
state)))
|
||||
|
||||
|
||||
;; ==========================================================================
|
||||
;; 16. Transitions — non-urgent signal updates
|
||||
;; ==========================================================================
|
||||
;;
|
||||
;; Transitions mark updates as non-urgent. The thunk's signal writes are
|
||||
;; deferred to an idle callback, keeping the UI responsive during expensive
|
||||
;; computations.
|
||||
;;
|
||||
;; (transition pending-signal thunk)
|
||||
;;
|
||||
;; Sets pending-signal to true, schedules thunk via requestIdleCallback
|
||||
;; (or setTimeout 0 as fallback), then sets pending-signal to false when
|
||||
;; the thunk completes. Signal writes inside the thunk are batched.
|
||||
;;
|
||||
;; Platform interface required:
|
||||
;; (schedule-idle thunk) → void — requestIdleCallback or setTimeout(fn, 0)
|
||||
|
||||
(define transition
|
||||
(fn (pending-sig thunk)
|
||||
(reset! pending-sig true)
|
||||
(schedule-idle
|
||||
(fn ()
|
||||
(batch thunk)
|
||||
(reset! pending-sig false)))))
|
||||
|
||||
Reference in New Issue
Block a user