Liking cljdoc? Tell your friends :D

taia.ds.datastar.adapters.handlers.discovery


discover-componentclj

(discover-component ns-path-keyword)
(discover-component ns-path-keyword controller-name)

Discovers a component by namespace path, searching all configured search paths in order.

Takes a namespace path like:

  • "chat.chat" -> tries my.app.components.chat.chat, then the next prefix, etc.
  • "chat.chat-page" -> similarly tries all configured prefixes

Optional controller-name parameter (should include '-controller' suffix):

  • If provided, uses that controller name instead of default
  • If nil, uses default behavior (appends '-controller' to component name)

The search-path scan is cached per [ns-path controller-name] (see taia.ds.datastar.adapters.handlers.discovery-cache); the vars are resolved fresh on every call, so a REPL redefinition is always picked up.

Returns map with:

  • :machine - the machine var from controller namespace
  • :component-fn - the component function var

Throws exception with descriptive message listing all searched paths if component cannot be found.

Discovers a component by namespace path, searching all configured search paths in order.

Takes a namespace path like:
- "chat.chat" -> tries my.app.components.chat.chat, then the next prefix, etc.
- "chat.chat-page" -> similarly tries all configured prefixes

Optional controller-name parameter (should include '-controller' suffix):
- If provided, uses that controller name instead of default
- If nil, uses default behavior (appends '-controller' to component name)

The search-path scan is cached per [ns-path controller-name] (see
`taia.ds.datastar.adapters.handlers.discovery-cache`); the vars are resolved fresh on every
call, so a REPL redefinition is always picked up.

Returns map with:
- :machine - the machine var from controller namespace
- :component-fn - the component function var

Throws exception with descriptive message listing all searched paths if component cannot be found.
sourceraw docstring

resolve-componentclj

(resolve-component component-name controller-name)

The component's machine and render fn, as vars (dereferenced on every event, so REPL redefs are picked up): {:machine-var :component-fn-var}. Throws like discover-component when the component cannot be found.

The component's machine and render fn, as vars (dereferenced on every event,
so REPL redefs are picked up): {:machine-var :component-fn-var}. Throws like
`discover-component` when the component cannot be found.
sourceraw docstring

set-component-search-paths!clj

(set-component-search-paths! paths)

Sets the ordered list of namespace prefixes used to resolve components. Call once at startup with the value from app-config. Example: ["my.app.components" "my.app.admin.components"]

Sets the ordered list of namespace prefixes used to resolve components.
Call once at startup with the value from app-config.
Example: ["my.app.components" "my.app.admin.components"]
sourceraw docstring

warm-cache!clj

(warm-cache! component-names)

Eagerly resolves component-names into the discovery cache so the first HTTP request for a component does not pay the namespace-load cost on the request thread (measured at 3.7-6.1s per component tree in bb dev).

Each entry is either a component name ("chat.chat") or a [component-name controller-name] pair for a non-default controller.

NEVER THROWS: a component that fails to resolve is collected into :failed and the rest keep warming. Returns {:warmed n :failed [{:component .. :controller .. :error msg}] :elapsed-ms n}.

Callers usually run this on a background thread at startup; call it inline instead if you need every component loaded before the first request.

Eagerly resolves `component-names` into the discovery cache so the first HTTP
request for a component does not pay the namespace-load cost on the request
thread (measured at 3.7-6.1s per component tree in `bb dev`).

Each entry is either a component name ("chat.chat") or a
[component-name controller-name] pair for a non-default controller.

NEVER THROWS: a component that fails to resolve is collected into :failed and
the rest keep warming. Returns
{:warmed n :failed [{:component .. :controller .. :error msg}] :elapsed-ms n}.

Callers usually run this on a background thread at startup; call it
inline instead if you need every component loaded before the first request.
sourceraw docstring

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