- Pages load Datastar v1.0.5 by default. Update a self-hosted
:datastar-urlto v1.0.5. h/exprreturns an expression object instead of a string. An attribute renders it, and anh/action, asreturn (<expression>), which needs Datastar v1.0.5 or later.strreturns the expression.- Multiple
h/exprforms compile as onedoinstead of joining with;. - Page responses are brotli-compressed at quality 5 instead of 11, the same
quality as the event stream. Large pages are sent much sooner and are
somewhat larger.
:brotli {:quality 11}restores the old page quality, but also applies it to the event stream, where it is much slower.
-
Render middleware lifecycle -
:render-middlewarefunctions now participate in the same form-1 / form-2 / form-3 lifecycle ladder as page handlers. Each middleware layer is mounted independently for the route prefix where it was declared (or the whole tab for handler-level middleware), so its form-2 setup, form-3:mount/:unmount, and mount-scopedh/watch!/h/spawn!subscriptions stay alive across sibling route navigations and tear down when its prefix path parameters change, when leaving its route group, or on tab disconnect. -
Brotli quality -
create-handlertakes:brotli, the compression quality for both page responses and the event stream:(h/create-handler routes :brotli {:quality 6}). The quality is from 0 to 11 and defaults to 5.:brotli falseturns compression off.
-
Single-commit full renders & nested partial dedup - Full renders now batch all
h/reactive/h/asyncsubview registrations, page cursor paths, and recorded render actions into a singleapp-state*swap (avoiding$O(R)$ cross-tab watcher wakeups per render), and partial renders skip inner dirty regions whose enclosing region is already dirty in the same batch. -
Per-path cursor tracking -
render-tabnow tracks whichtab-cursor,session-cursor, andglobal-cursorpaths are dereferenced outside of enclosingh/reactive/h/async:deps. Mutating a cursor used only as anh/reactiveorh/asyncdep now triggers only a partial render of that region (no full page re-render), and writing an unread cursor triggers no render. -
Signal-only SSE patches - Writing to a plain
h/signalnow sends only adatastar-patch-signalsSSE event without triggering a full page re-render (and coexists with partialh/reactiverenders without upgrading them to a full render). -
Route index - The route-name index is compiled once into the router at
create-handlertime (and rebuilt when a routes Var changes) instead of constructing a newreitit.core/routeron everyh/navigatelink and render.
-
Actions in child reactive regions - An
h/action(or anh/exprreferencing one) created in a page or parenth/reactiveregion and passed into a childh/reactiveregion now stays clickable after the child region partially re-renders. -
Component attributes - An
h/exprorh/actionpassed as adefcattribute renders asreturn (<expression>), the same as any other attribute, instead of as JSON. -
Nested regions - A region whose body is only another region (an
h/reactiveorh/asyncwith nothing around it) no longer fails with "Duplicate region id". Each region now gets its own element and keeps its own id. Before, with:keys, the outer region's id replaced the inner region's id. The outer region is wrapped in a div. -
Region wrappers - The div Hyper wraps a region's body in (when the body is a seq, text, nil, or another region) is now
display: contents, so it no longer affects flex or grid layout. Browser tests that wait for such a region's element to be visible need to wait for its children instead. -
clj-kondo hooks -
defcsegments are linted as ClojureScript, sothis-as,js-objandarrayresolve. This takes a clj-kondo release with:clj-kondo/langsupport. Older versions lint the segments as before.
Nothing in the documented API was removed, but sessions now behave as intended, which an app may notice:
- Sessions end. A session is removed once its last tab has been gone for the
disconnect grace period (
:disconnect-grace-ms, 3 minutes by default), soh/session-cursordata no longer outlives a person's tabs. Restore what must last longer, such as sign-in, from your own cookie (seewrap-rehydrate-sessionin the README), or raise:disconnect-grace-ms. - Tabs belong to their session. A tab's actions, uploads, navigations and
event stream are refused once its session cookie is cleared or replaced,
and a session cookie the server does not hold gets a new session id. Sign
people in with
rotate-session!and out withend-session!(see Features). - The session cookie is now
SameSite=Lax, andSecureover HTTPS, and only page responses set it. A cross-site POST, such as an OAuth or SAMLform_postcallback, arrives without it; an app embedded in another site's iframe needs:session {:cookie {:same-site :none}}. - Hyper's own endpoints refuse requests whose
Sec-Fetch-Siteheader issame-siteorcross-site. - Render middleware always receives rendered hiccup (or a Ring response) from the handler. It no longer sees a page's render function or view on the page's first render.
- A write through
h/session-cursorto a session that no longer exists is dropped, with a:hyper.warn/session-cursor-write-droppedwarning. hyper.server/wrap-hyper-contextis replaced byhyper.ring.middleware/wrap-hyper, which takes the handler first.
-
Signing in and out - Actions can rotate or end their session with
effects/rotate-session!andeffects/end-session!, and routes (an OAuth or SSO callback, a magic link, a form post) withhyper.ring:(-> (redirect "/") (h.ring/rotate-session! req)). Rotating gives the session a new id and keeps its data; its open pages reconnect a second or two later with the new cookie and keep their tab state, while a page elsewhere holding the old id gets a fresh session. Ending removes the session and deletes its cookie, and its open pages reload into a fresh session. Both take effect once the action or response is done, so a sign-in form posted or a link clicked from a Hyper page lands on its redirect target.hyper.test/test-actionreports them as:session(:endor:rotate) in its:effects. -
hyper.ring-h.ring/session-idgives the request's session id when the server holds that session, andh.ring/endpointtells Hyper's own requests (:action,:upload,:navigate,:events) apart from page and app routes. A route outsidecreate-handleruseshyper.ringby wrapping itself in(-> route (hyper.ring.middleware/wrap-hyper app*)), with the atom passed tocreate-handleras:app-state. -
Session cookie options -
create-handlertakes:session {:cookie {...}}, Ring cookie attributes merged over the session cookie's defaults, including:name:(h/create-handler routes :session {:cookie {:name "sid" :same-site :strict}}). Every page load sets the cookie again, so it expires 7 days after the last visit rather than the first. -
h/run-in-tabs!- Runs a function in every open tab, or in those where a predicate is true, with each tab's context, from an action or a background thread:(h/run-in-tabs! app* #(= user-id (:id @(h/session-cursor :user))) effects/end-session!). Its effects act on each tab, including cookies.effects/rotate-session!throws in it: rotate in the person's own action or route, so only their browser gets the new id. -
Middleware redirects - A redirect that
:middlewarereturns for an action, upload, back/forward navigation or event stream request sends the tab to itsLocationwith a full page load, so middleware can refuse a request with(ring.util.response/redirect "/sign-in"). A redirect on a page load stays a redirect. -
Testing -
hyper.test/test-actiontakes the signal values the client sends with an action:(ht/test-action result "send" {:signals {:draft "Which funds?"}}). A signal not given reads as its default value. Before, it gave its"$name"expression.
-
Sessions - A tab belongs to the session it was loaded in: its actions, uploads, navigations and event stream are refused once the session cookie is cleared or replaced, so signing a person out stops their open tabs. Before, any request naming the tab ran.
-
Session and tab leaks - Sessions were never removed, and every request could leave a tab behind. Now a session is removed a grace period after its last tab, or after it was left with no tabs; a page whose event stream never connects (bots, link previews,
curl) is removed after the grace period; a route returning a Ring map (an API route, a redirect) leaves no tab or new session behind; and a late session-cursor write or render no longer brings a removed session back. -
Reconnecting - A page whose tab the server no longer has (after a server restart, a grace period that ran out, or an ended session) now reloads itself when its event stream reconnects. Before, it stayed at "reconnecting" until reloaded by hand. Pages of one browser loaded at the same time without a session now end up in one session.
-
Reaping - A tab whose event stream connects just as its grace period runs out is either kept, with its state, or reaped with its stream ended and the page reloaded. Before, the reaper could tear the tab down while its stream was attaching.
-
Cross-site requests - Hyper's actions, uploads, navigations, event streams and cookie requests answer a request whose
Sec-Fetch-Siteissame-siteorcross-sitewith a 403, before the app's:middlewareruns. This needs no configuration behind a proxy. Page routes are not affected. -
Render middleware - A layout middleware that wraps the handler's result now works with form-2 and form-3 pages. Before, the page's render function or view ended up inside the hiccup and the render failed. A page's setup or
:mountruns once, even when middleware calls the handler twice. -
Reactive regions - A region drawn again with different deps now watches its new deps and releases the old ones, in any order; before, it kept watching the deps it was first drawn with. A region's re-render removes the nested regions it no longer draws, a nested region without a
:keykeeps its id, a region listing the same source twice releases it, and a region whose deps change while its tab is disconnected keeps its watches until it reconnects. -
clj-kondo hooks -
h/reactiveandh/asyncaccept deps given as a symbol or an expression, such as(h/reactive deps ...). A map, keyword, string, number, boolean or nil in place of deps is still reported. -
execute-script!- A script for a tab whose connection dropped is sent when it reconnects. Before, it was dropped.
BREAKING: create-handler no longer takes hiccup for the Datastar script
tag. Pass the URL of Datastar's ES module bundle instead. Hyper adds the tag
itself and imports Datastar from the same URL to register its action.
;; before
(h/create-handler routes
:datastar-script [:script {:type "module" :src "/js/datastar.js"}])
;; after
(h/create-handler routes
:datastar-url "/js/datastar.js")- Passing
:datastar-scriptnow throws when the handler is created. - The tag can no longer be suppressed with
nil. hyper.server/default-datastar-scriptis replaced byhyper.server/default-datastar-url.
If you did not set :datastar-script, nothing changes.
BREAKING: actions no longer use one Datastar @post each. They go through
@hyperAction, which posts a tab's actions to /hyper/actions?tab-id=…. The
server runs them one at a time, in the order they were made, each against the
render it was made on. See How actions run.
- A single action can no longer be posted to
/hyper/actions?action-id=…. window.hyper.encodeClientParamsandhyper.actions/execute-action!are removed.- A slow action now holds up the tab's later actions. Move long-running work to
h/spawn!.
- Ordered actions - Actions now run one at a time, in the order they were made, making them more consistent with user expectations and the state they operate against.
- Expanded Squint - Better support for Clojure expressions in
h/expr, with a bundle served by Hyper. Use:tree-shake?for smaller bundles that only ship the code your components and expressions depend on. - Custom Datastar URL support - Point Hyper at an arbitrary endpoint via
:datastar-url. - Easier component debugging -
:source-map?option forcreate-handlerto generate source maps. navigating?*signal to know when a route is changing.- Support for multiple elements being returned from
h/reactiveandh/async. :param-transformer- Option forcreate-handlerthat controls how route parameters are read from URLs and written back into links. Defaults to Malli's string transformer.
- Route params - Parameters now stay the same across links, page loads and back/forward navigation.
- Signals - A value set by the server is no longer overwritten by an action made just before it.
h/route- Works inside actions, and reflects route changes made earlier in the same action.- Local signals - Signals declared during a partial re-render now work without waiting for a full render.
h/spawn!- Calling it from an action now starts a new worker every time.- Client params - Params written with multi-statement
h/exprforms no longer cause a syntax error. h/expr-=,strand boolean operators now compile correctly.- Live reload - Now picks up form-2 and form-3 render functions.
server/start!- The:stop-timeout-msoption is now respected.connection*- Now set correctly on page load.- Parameter validation - Invalid route parameters now return a readable error.
- Preserve explicit nil in cursor default init
- Gate Clojars release on CI
- Fix missing request context bindings in teardown and partial renders
- Don't drop cursor writes made during flush
DEPRECATION: You should no longer require hyper.protocols or hyper.client-params directly.
Maps the following into hyper.core directly:
action-name— wrapscontext/*action-name*route— wraps(:hyper/route *request*)Watchable— re-export ofhyper.protocols/Watchableclient-param— re-export ofhyper.client-params/client-parammultimethod
- Add bb release task and drop git-cliff header
- Note pre-1.0 breaking-change policy
- Pin squint via maven
Initial public release.