Fork me on GitHub

Using the lein re-frame-template with Secretary (`+routes`) for the first time. Trying to figure out what this whole client-side routing thing is all about. First question: I'd like to avoid having the "#" in my URL, so I commented out the ; (secretary/set-config! :prefix "#"). But what should I change the link to "#/about" to to use my non-# URL? If I click on a URL to just /about/, I get a error, not found. And my attempts to trigger a navigation event through (secretary/dispatch! "about") don't do anything. Am I on the right track or have I gone helplessly astray somewhere already?


I guess I can live with that # in my URLs, like "/#/" …


TIL: Bad things happen when you don't return the db from a handler. simple_smile


@deas: use middleware which checks the schema of the db You pretty quickly find out when an event handler is wrong in some way.


@mikethompson: Good point. Thanks! simple_smile


@mikethompson: have you or anyone else ever run into a case where schema checks were a bottleneck or performance burden? I know they're really good for me, like, kale-grade good for me, but…


schema checks are runtime checks, so you take a performance hit. I normally only enable them in tests.


@fasiha: schema checks kill my app performance, so i only use them in development


does reframe handle lazy sequences without issue, or am I doing something wrong, or should I always realize a lazy when dealing with reactions?


for example…

(let [thing (reaction (:thing @db)
       [filters (reaction (@db :filters)]
  (reaction (filter-with-filters @filters @thing)))
where filter-with-filters returns (filter …) (which is lazy).


if I have a view subscribing to that reaction, is it going to trigger on change if the result is lazy?


on second thought, perhaps this is a broader reagent question


@lwhorton: the way I understand it (as @hugobessaa was explaining to me the other day), if db changes, thing and filters will rerun their reactions. Then, filter-with-filters gets rerun. Any view that depends on this subscription will get rerun. So one way I'd look at the question is, it doesn't matter so much that the filters lazy list changed, but that db changed first.


From another perspective, supposing your ratom was a lazy seq, how would reagent know that it changed? It'd have to do (= old-lazy-seq current-lazy-seq) at some level, which performs a deep compare, which iterates over all elements of the lazy seq. (At least, that's what I derive from observing that comparing infinite lists appears to infinite loop: (= (repeat 1) (repeat 1)) ; doesn't end.)


So based on both those perspective, I'd tentatively say the answer to your question is, yes, the view will rerun if its subscribed lazy seq changes.


@fasiha: regarding secretary and #, you can use to mask the #. the reagent-template has a working version of secretary and accountant


Just added a +cider option to re-frame-template. lein new re-frame myapp +cider CC: @escherize