Fork me on GitHub

Is there a way to remove the global reference to the re-frame.db/app-db? I’m trying to use Stuart Sierra’s Component library with re-frame, and it feel like a hack directly modifying the global state to reset it. Also, I’m trying to use datascript and it feel wrong to (swap! re-frame.db/app-db assoc :ds-db datascript-db) into it just so I can access it from within handlers and subscriptions. Ideally, I’d be able to pass in whatever data structure I want and have that handed over to handlers and subscriptions.


We developed for use with re-frame - it is similar in intent to Component in terms of setup, but it doesn't have a teardown part.


To "inject" a datascript connection into an event handler, I'd be using an Interceptor which adds the connection to the coeffects


That's how app-db is made available ... an interceptor adds it to the coeffeects


Cool. I’ll look into this. Thanks!


I am trying to use a javascript library to render a document in a component in my app. the problem is that the div where the document is rendered is targeted with jquery. It works the first time I go into a pannel but the second time it seems like jquery doesn't find the div anymore but it is still there.


I tried using a tier 3 component but then the component doesn't update when the document becomes available


@danielcompton yes. but it will not work out of the box with the undo/redo 😞


it does update when I revisit the page


@ericfode yes, I was inspired by elm conference and their debugger. but I think not all using def-view macro, I think this is a really useful thing. for me at least 🙂


why doesn't my component update when diagram changes ?


can you provide the code of function where you call diagram-view


using prints I noticed that diagram in :reagent-render is there but in component-did-update it is nil


note that the first time I visit the page an event ask for the diagram with ajax so it is nil, and is added to instance via the subscription


the reason I am trying to call utils/diagram-view after mount is because it is an external js lib that grabs the div with xquery


is it possible that component-did-update is still using the old value of diagram (nil) ?


Seems more of a reagent question I will ask on the dedicated chan


actually I figured a fix in case someone is interested but I am not sure I like it:


that way diagram-view is only rendered when diagram exists and the jquery selector is only applied after mount.


guys, im trying to make a dead simple dev server for SPA with re-frame and i stumbled upon the routing problem i just want to serve css and js as asstets and on all other request return index.html (for client-side routing) how should i configure my server? this doesn’t work for me

(defn handler [request]
  {:status 200
   :headers {"Content-Type" "text/html"}
   :body (slurp ( "resources/index.html"))})

(defroutes routes
  (context "/static" []
    (route/resources "/css" {:root "css"})
    (route/resources "/js" {:root "js"}))
  (GET "/*" [] handler))

(def wrapped-routes
  (-> routes


it’s funny. i just want to serve a couple of files 😁