juxt / clip

Light structure and support for dependency injection
MIT License
228 stars 15 forks source link

Common pre-start deduplication #8

Open SevereOverfl0w opened 4 years ago

SevereOverfl0w commented 4 years ago

If multiple components have the same :pre-start, it should be possible to "deduplicate" them. A common example would be wanting migrations to run before both a DB connection component, and something else which uses JDBC directly (e.g. quartz).

We want run-once behaviour, but we want it to be explicit somehow. It should perhaps have a different name from :pre-start.

SevereOverfl0w commented 4 years ago

Example above doesn't make much sense. The DB connection would just have migrations run as part of :post-start. If something was conditional (e.g. on quartz) it wouldn't be duplicate as part of the :pre-start.

Will wait for there to be a use-case for this. Contributions welcome here.

SevereOverfl0w commented 3 years ago
{:components
 {:a (io/resource "public")
  :figwheel (run-the-build)}}}

This won't work on first run as :a depends on the side effects caused by :figwheel, but doesn't depend on it's value.