Liking cljdoc? Tell your friends :D

Migrating from the in-app namespaces

taia.ds was extracted from an application where the same code lived under ds.*, state-machines.*, logging.* and extensions.*. Polylith needs a top namespace, so everything moved under taia.ds.*.

BeforeAfter
ds.interfacetaia.ds.datastar.interface
ds.adapters.handlers.context/ctx->data-signalstaia.ds.datastar.interface/ctx->data-signals
ds.adapters.handlers.response/->htmltaia.ds.datastar.interface/html-response
ds.adapters.*, ds.domain.* (internal)taia.ds.datastar.adapters.*, taia.ds.datastar.domain.*
state-machines.interfacetaia.ds.state-machines.interface
state-machines.test-helperstaia.ds.state-machines.test-helpers
logging.interfacetaia.ds.logging.interface
extensions.interfacetaia.ds.extensions.interface
search path "ds.adapters.components"gone: the library has no components of its own, so the default is [] and the application lists only its own prefixes
vendored /js/datastar.js, /js/sse-reconnect.jsclasspath datastar/js/…, served via wrap-resource "datastar"

Behaviour is unchanged. Two additions: ctx->data-signals and html-response are on the interface, so component code no longer needs the adapters.handlers.* namespaces.

Mechanical rewrite:

perl -pi -e 's/(?<![\w.\-])ds\.(interface|adapters|domain)\b/taia.ds.datastar.$1/g;
             s/(?<![\w.\-])state-machines\.(interface|test-helpers)\b/taia.ds.state-machines.$1/g;
             s/(?<![\w.\-])logging\.interface\b/taia.ds.logging.interface/g;
             s/(?<![\w.\-])extensions\.interface\b/taia.ds.extensions.interface/g' $(git ls-files '*.clj' '*.cljc')

Then update the search-path configuration and remove the vendored JS files.

Coming from an app on Datastar RC8

taia.ds 0.5.0 ships Datastar 1.0.5 and the Clojure SDK 1.0.0-RC13. If your application still runs its own copy of these namespaces on RC8, check these after the rename above:

  • Delete your own datastar.js and sse-reconnect.js. If the app still serves its vendored copies, whichever wrap-resource runs first wins. The page can then keep running RC8 and the old watchdog, which loops when a live stream is re-opened, with nothing to tell you.
  • Move clicks off /ds/nds-connect/…. Since 0.4.0, every request there opens a connection and replaces the page's one. A SEND_MESSAGE POSTed there resets the connection instead of sending a message. Post it to /ds/nds/….
  • Same method + same URL now cancel each other, page-wide (RC8: per element). Put per-item ids in the URL, and open each connection from one element. See Gotchas.
  • Connections whose URL changes (INIT?session-id='+sid, ?since=) need nothing: the server closes the stream a new connection replaces (datastar-nds-superseded). A hand-rolled AbortController passed as requestCancellation keeps working too.
  • Retry options. retryMaxWaitMs is now retryMaxWait. retryMaxCount: n now allows n retries (RC8 gave up at the n-th failure), and neither the count nor the backoff resets after a successful reconnect. A {retryMaxCount: 2} meant to fail fast waits one more backoff now: use 1 for RC8's timing.
  • data-bind. An unseeded select now yields a string, not a number. Checkboxes and radios sync on input. A morph that changes a bound input's value updates its signal (Gotchas).
  • DELETE requests send signals in the datastar query parameter, like GET: no body, no Content-Type. Large signal stores can hit the server's request-line limit; use filterSignals.
  • After max retries, Datastar throws FetchFailed. It surfaces as an unhandled rejection (pageerror in Playwright), not as a console.error.

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close