This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-23
Channels
- # announcements (3)
- # asami (5)
- # babashka (1)
- # beginners (38)
- # biff (4)
- # calva (12)
- # cider (2)
- # clj-commons (6)
- # clj-kondo (46)
- # clj-on-windows (1)
- # clojure (50)
- # clojure-europe (41)
- # clojure-nl (3)
- # clojure-norway (2)
- # clojure-uk (16)
- # clojured (3)
- # clojurescript (49)
- # conjure (1)
- # cursive (29)
- # datahike (6)
- # datascript (4)
- # emacs (70)
- # funcool (1)
- # google-cloud (12)
- # graalvm (10)
- # graalvm-mobile (7)
- # gratitude (4)
- # hyperfiddle (1)
- # joyride (26)
- # lsp (16)
- # malli (23)
- # nbb (5)
- # off-topic (23)
- # polylith (32)
- # re-frame (23)
- # releases (3)
- # remote-jobs (1)
- # reveal (3)
- # tools-build (16)
- # xtdb (50)
I am working on the reframe and created a component using reagent/create-class
and inside :reagent-rendor
,
I have a condition, which filter the data and those data I am adding to the reframe db atom like below
(defn do-something
(reagent/create-class
{:reagent-render
(fn [{:keys [data payload status]}])
(if (= data "something")
(dispatch [:do-something-else 3]])
(dispatch [:do-something "riyu"]]))
}))
Is it right to call dispatch method anywhere? or we should call it always when even occurred
If we cannot call dispatch function, How to insert the data in reframe dbDon't call dispatch
in the render function.
The right approach is outlined here: https://day8.github.io/re-frame/FAQs/LoadOnMount/
thanks for response @U2FRKM4TW, How can I add the data into db if I want to ?
yes, But in my scenario, I am designing a pagination, where as I wanted to store each page db value, which I am doing for pagination
I'm sorry but I have no clue what you mean. I've implemented pagination many times, and it has never required dispatching events from within the render function itself (i.e. not as a reaction to some user input).
I have re-frame app using http-xhrio
to obtain CSV data from a server. It's all working but I would like to offer the data as a file to download. I was hoping to hand it off to the browser but don't know the mechanisms to achieve that. Can anyone point me in the right direction?
Not re-frame specific at all. Just create an <a download href="...">...</a>
on your page with the right URL.
If you don't want a link but rather want the download to happen as a reaction to some user's action (which is not a click on a URL), you can use e.g. https://github.com/eligrey/FileSaver.js/
Well, you can do it all manually, there's no magic. :) But making it work properly across browsers used to be a pain. Maybe it's not anymore, I haven't checked for a few years.
Yeah, you have to use a separate AJAX request then, unless that endpoint is the same server and your app and it supports cookies.
it is on the same domain ... a Lambda behind an API GW behind CloudFront. I could change everything to cookies but that feels like a pain now and we want some POSTs via that site too so I'm not so enthusiastic about doing it
I mean I'm in control of everything so I could do the cookies thing but cookies feel yucky if you know what I mean
Actually, no clue what you mean by cookies being yucky. As far as I'm aware, manually storing and providing authorization tokens is much worse in any situation where you could use secure cookies that are specifically designed to be used for authentication.
ok, the integration to authentication service I'm using (OKTA) uses access tokens so that's what I'm using