To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.
PR #808
Is your feature request related to a problem? Please describe.
When compiling Datastar expressions server-side (typically 1-5 line snippets for signal binding, element manipulation, and action invocation), compile-string* currently only accept strings.
The goal is to compile these expressions server-side while maintaining 60fps page server-side rendering. The roundtrip model (compile all snippets at macros compile time) is acceptable for static compositions, but wasteful when runtime composition of multiple dynamic snippets is needed - forcing unnecessary stringification of forms adds compute overhead that impacts SSR performance.
Describe the solution you'd like
Allow compile* and transpile* to accept either:
- A string (current behavior, parsed via read-forms)
- Clojure forms (pass directly)
Describe alternatives you've considered
- Pre-serializing snippets at compile time - loses flexibility for dynamic composition
Additional context
Datastar expressions are snippets like: https://github.com/outskirtslabs/datastar-expressions#example-usage
Expressions compose example:
(let [x (d*js (.. evt -target -value))
num 55
y (d*js (+ ~num ~x))]
(d*js (set! $signal ~y)
(set! $other-signal "no")))
Also a comment about API limitation outskirtslabs/datastar-expressions#18 (comment)
To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.
PR #808
Is your feature request related to a problem? Please describe.
When compiling Datastar expressions server-side (typically 1-5 line snippets for signal binding, element manipulation, and action invocation),
compile-string*currently only accept strings.The goal is to compile these expressions server-side while maintaining 60fps page server-side rendering. The roundtrip model (compile all snippets at macros compile time) is acceptable for static compositions, but wasteful when runtime composition of multiple dynamic snippets is needed - forcing unnecessary stringification of forms adds compute overhead that impacts SSR performance.
Describe the solution you'd like
Allow compile* and transpile* to accept either:
Describe alternatives you've considered
Additional context
Datastar expressions are snippets like: https://github.com/outskirtslabs/datastar-expressions#example-usage
Expressions compose example:
Also a comment about API limitation outskirtslabs/datastar-expressions#18 (comment)