This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-06
Channels
- # beginners (95)
- # boot (3)
- # cider (13)
- # cljs-dev (9)
- # cljsjs (1)
- # cljsrn (35)
- # clojure (78)
- # clojure-dev (5)
- # clojure-italy (6)
- # clojure-nl (9)
- # clojure-russia (13)
- # clojure-spec (1)
- # clojure-uk (74)
- # clojurescript (59)
- # community-development (6)
- # core-async (41)
- # css (110)
- # data-science (2)
- # datomic (22)
- # defnpodcast (1)
- # devcards (1)
- # docs (1)
- # editors (6)
- # emacs (51)
- # figwheel (1)
- # fulcro (66)
- # jobs (1)
- # jobs-discuss (75)
- # lumo (51)
- # mount (2)
- # off-topic (33)
- # pedestal (24)
- # proton (3)
- # re-frame (29)
- # reagent (92)
- # reitit (16)
- # shadow-cljs (16)
- # spacemacs (4)
- # specter (6)
- # vim (6)
- # yada (7)
Hello! Could anyone help me please?
I wrote a cljs project. It is a reagent component on the re-frame. I require this project from :dependencies
in a project.clj. But I have a problem. If a project where I require my component is written on the re-frame too, then an app-db this two projects mix with each other.
I think It is not quite right. What should I do in this case?
Hi in a reg-event-db
handler i need to use data which might not be fetched yet? What pattern should I use?
For example: there are a list of items, clicking on one of those dispatches an event :some-event
which uses items data in its handler and as well as sets the url to /item/3
. The problem would appear when the page is reloaded in that url /item/3
.
youβre probably creating a spa, and need to use something like secretary https://github.com/gf3/secretary to do changes to the url. Then when the url changes you can send a request to get item 3, and change the db on the response, which might trigger a re-render
core.cljs calls (routes/app-routes)
before any server data has been fetched. I have (defroute "/item/:id" (re-frame/dispatch [::some-event id]))
@al.vyguzov i am doing that currently (live editor built in re-frame, examples written in re-frame....) and the solution that is working for me so far is namespacing the db / subs and events.... I am today looking at making some middleware to "automate" this
@fj.abanses
Thank you! I decided keep my add-db under the :swipe-component
key
@al.vyguzov π same here... let me know if you come up with an "automated" solution... i am looking into it myself
@fj.abanses Ok! I know that it isn`t best solution, but I wrote interceptor
(def add-swipe-component-key
(re-frame.core/->interceptor
:id :add-swipe-component-key
:before (fn [context]
(assoc-in context [:coeffects :db] (:swipe-component (:db (:coeffects context)))))
:after (fn [context]
(let [db (:db (:effects context))]
(-> (update context :effects dissoc :db)
(assoc-in [:effects :db :swipe-component] db))))))
would it be possible to make a javascript jsx port of reframe? I like re-frame a lot but my day job is probably going to be js for the foreseeable future.
@matthewdaniel I think I read somewhere it already exists, there it is http://karolmajta.github.io/reframe-js/
this is a fairly new project that seeks to bring all the great data-centric ideas from clojure to JS
the complementary article https://medium.com/@thi.ng/how-to-ui-in-2018-ac2ae02acdf3
granted it's not jsx based, all data similar to re-frame
there's a hiccup templating system in there
Yeah, it's one of the few articles I feel is aimed at the JS web dev crowd about how clojure devs do things, in addition to web development
Not cloaked in functional mysticism that we're known for π
Also I've heard that redux has a similar architecture pattern to re-frame
react + redux => re-frame with some improvements from what I've seen. The state is first class, while redux can get messy when your app is bigger than a demo
and I mean reframe has the improvements π
I'd agree with that π