Fork me on GitHub
#re-frame
<
2017-07-09
>
mikethompson05:07:09

Thanks to Eric's tutorial, it looks like re-frame is (just) on the front page of Hacker News https://news.ycombinator.com/item?id=14725114

andre10:07:59

one question about re-com, for splits mouseout doesn't work if i drag to outside the browser window while dragging?

andre10:07:54

because if i release mouse outside and return it back, splits still dragging but mouse is up

andre11:07:55

oh ok it's not only outside the browser window, it works the same outside html container

andre11:07:10

there is no release outside

andre11:07:19

or something like that

nenadalm13:07:12

@kenny related to your question here: https://clojurians-log.clojureverse.org/re-frame/2017-03-08.html#inst-2017-03-08T02:29:30.007278Z. I was just looking for the same thing (I didn't notice that somebody would reply - please correct me If I am wrong). Currently, I am using the add-watch function. You can see it here: https://github.com/nenadalm/Warehouse/blob/9dd3fb332cf75751c7ec6604697affe78d4a416f/frontend/src/warehouse/index.cljs#L17. Where I compare old :components with new ones and in case of change I update index for search and trigger event taking new value into account (during current search/filtering). I guess you didn't come up with something better meanwhile?

mikethompson13:07:44

@nenadalm can you confirm your usecase a bit more? Sounds like you: 1. want to monitor some paths (x and y) within app-db, and ... 2. when the value at x or y changes, .... 3. dispatch some event Is that it?

mikethompson14:07:30

If so, does the need to monitor x and y come and go? Or does this need last for the entire life of the app.

mikethompson14:07:12

I have to go to bed but ... using reagent's track might work ...

(defonce tracking-x-y reagent.core/track
  (fn [] 
     (let  [x-val  @(re-frame.core/subscribe [:query-x])
            y-val @(re-frame.core/subscribe [:query-y])]
        (re-frame.core/dispatch [:something changed x-val y-val]))))
Ie. an event will get dispatch each time either subscription fires.

nenadalm14:07:06

@mikethompson thanks. That seems to be what I was looking for. The use case you described is exactly what I want (+ some of the values aren't paths but are computed in subscriptions). The need lasts for entire life of the app. Use case is that I have text filter which filters some items of list. User can change the list by adding/changing items by using 4 handlers (after confirmation, added/edited item should stay visible only if it matches the filter). Another use case might be in an infinite scroll for the list I am currently thinking about. (Total number of records will have to be changed whenever visible items changes (visible items are computed using subscription using all items + filter value - but this will probably somehow change after I'll store data more efficiently. Currently they're all in local storage under 1 key - fine for my use cases for now...).

andrea.crotti15:07:55

so suppose I want to integrate some external js into my page

andrea.crotti15:07:04

for example Stripe or google maps

andrea.crotti15:07:24

what's the general process to do that?

andrea.crotti15:07:59

for Stripe I simply there was something like

<form> <script data-s.... </script> </form>

andrea.crotti15:07:14

and I just rewritten everything in hiccup style

andrea.crotti15:07:36

for google maps I even found some clojurescript snippets around using reagent for example

andrea.crotti15:07:08

so well I just wonder how people proceed, since I've never really done it so far