This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-07
Channels
- # announcements (32)
- # asami (11)
- # babashka (5)
- # babashka-sci-dev (4)
- # beginners (65)
- # biff (11)
- # calva (35)
- # clerk (2)
- # clj-kondo (8)
- # clj-on-windows (4)
- # clojars (4)
- # clojure (122)
- # clojure-canada (1)
- # clojure-europe (31)
- # clojure-italy (6)
- # clojure-nl (1)
- # clojure-norway (7)
- # clojure-spec (3)
- # clojure-uk (2)
- # clojurescript (3)
- # core-async (7)
- # core-logic (1)
- # data-science (13)
- # datalog (3)
- # datavis (3)
- # datomic (15)
- # deps-new (4)
- # emacs (34)
- # figwheel-main (1)
- # fulcro (1)
- # funcool (1)
- # holy-lambda (1)
- # lsp (41)
- # malli (21)
- # membrane (5)
- # midje (1)
- # off-topic (5)
- # polylith (3)
- # proletarian (6)
- # re-frame (6)
- # reitit (6)
- # remote-jobs (4)
- # sci (1)
- # shadow-cljs (96)
- # sql (31)
- # testing (23)
- # xtdb (49)
Another noob Q: I have a handler fn that's making an API call and redirecting to /app
. But when I click the button that dispatches this handler (the API call works and all), I am redirected to a version of /app
that has multiple copies of the UI, that number depending on the number of times I've clicked the button. (I guess I should ask a question: what am I doing wrong?)
Are you using htmx on that button? If so, you might want to check out the swapping: https://htmx.org/docs/#swapping
The default behavior is innerHTML
which places the new HTML it receives inside the element that made the call, which create a nested UI effect if you're receiving the whole webpage every time.
in some situations the answer is to replace innerHTML
with outerHTML
, though in this case it sounds like you might want to just do a regular form that posts to your endpoint without htmx.
I.e. if you want to refresh the whole page or navigate to a new page, then no need for htmx. but htmx is handy if you want to do some kind of "small" interaction where reloading the page would be overkill/degrade the experience. e.g. I use htmx for the like + dislike buttons in the app I work on.
I am jacked into the nrepl server started by biff. I am trying to figure out how to use the secrets, I tried this and it failed at the repl:
((:biff/secret @biff/system) :cookie/secret)
In secrets.env COOKIE_SECRET=randomstring is set.
First thing to check is if config.edn
contains a key called :cookie/secret
. The key added by default is called :biff.middleware/cookie-secret
, so that may be your problem.
Are you expecting that Biff takes :cookie/secret
and infers that the env var for it should be COOKIE_SECRET
? That might be a point of confusion. Biff uses the :cookie/secret
key to check config.edn
for the name of an environment variable, and then returns the value of that env var.
Ahh so I have to add a secret to secrets.edn and a pointer for that secret into config.edn?
Yep. (though secrets.env
, not secrets.edn
)
Yeah, just have edn on the brain. Thanks, that's enough for me to get to the next roadblock. Having much fun with biff.
Excellent, glad you're enjoying it!