Remove redundant features: ref sugar, suspense, transitions
- ref/ref-get/ref-set! functions removed (just dict wrappers — use dict primitives directly). The :ref attribute stays in adapter-dom.sx. - Suspense form removed (if/when + deref on resource signals covers it) - Transition function removed (fine-grained signals already avoid jank) - Kept: error-boundary, resource, portal, :ref attribute Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -306,28 +306,7 @@
|
||||
|
||||
|
||||
;; ==========================================================================
|
||||
;; 12. Refs — mutable boxes, no reactivity
|
||||
;; ==========================================================================
|
||||
;;
|
||||
;; A ref is a mutable container that does NOT trigger subscriptions when
|
||||
;; written. Like React's useRef: holds mutable values between renders, and
|
||||
;; provides imperative DOM element access via :ref attribute.
|
||||
|
||||
(define ref
|
||||
(fn (initial)
|
||||
(dict "current" initial)))
|
||||
|
||||
(define ref-get
|
||||
(fn (r)
|
||||
(get r "current")))
|
||||
|
||||
(define ref-set!
|
||||
(fn (r v)
|
||||
(dict-set! r "current" v)))
|
||||
|
||||
|
||||
;; ==========================================================================
|
||||
;; 13. Named stores — page-level signal containers (L3)
|
||||
;; 12. Named stores — page-level signal containers (L3)
|
||||
;; ==========================================================================
|
||||
;;
|
||||
;; Stores persist across island creation/destruction. They live at page
|
||||
@@ -411,7 +390,7 @@
|
||||
|
||||
|
||||
;; ==========================================================================
|
||||
;; 15. Resource — async signal with loading/resolved/error states
|
||||
;; 14. Resource — async signal with loading/resolved/error states
|
||||
;; ==========================================================================
|
||||
;;
|
||||
;; A resource wraps an async operation (fetch, computation) and exposes
|
||||
@@ -440,27 +419,3 @@
|
||||
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