This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-29
Channels
- # aws (1)
- # aws-lambda (2)
- # bangalore-clj (3)
- # beginners (26)
- # boot (25)
- # braveandtrue (1)
- # cider (5)
- # cljsrn (7)
- # clojure (144)
- # clojure-android (2)
- # clojure-czech (1)
- # clojure-greece (3)
- # clojure-italy (17)
- # clojure-poland (5)
- # clojure-russia (25)
- # clojure-spec (9)
- # clojure-uk (100)
- # clojurescript (85)
- # core-async (42)
- # cursive (11)
- # datascript (2)
- # datomic (25)
- # duct (3)
- # emacs (5)
- # figwheel (2)
- # fulcro (49)
- # graphql (16)
- # hoplon (8)
- # klipse (10)
- # leiningen (10)
- # lumo (9)
- # off-topic (12)
- # om (14)
- # onyx (25)
- # planck (34)
- # portkey (6)
- # re-frame (43)
- # reagent (4)
- # remote-jobs (2)
- # ring (36)
- # ring-swagger (1)
- # rum (1)
- # shadow-cljs (187)
- # specter (25)
- # sql (5)
- # unrepl (75)
I'm doing a bit of re-frame specific URL routing (think Secretary style but routes are based on re-frame events) and I'm thinking about making it into an effect library - if anyone is interested I'll put some of the details and questions in a thread (the most important being whether my name is too obscure and hopefully some bike shedding around that).
The main ideas is to make the URL routes just fall out of your effects - when you have an effect that should have a distinct route, you add an interceptor or an effect and it will properly update the URL.
If you manually browse to a URL (such as your first page visit being to a deep link) it should dispatch the matching event (knowing only what the route can tell you). If you browse using forward, back, or manual entry when the site is already loaded it will dispatch those events as well.
I haven't found anything quite like this, and I haven't been happy trying to integrate any other routing libraries in the past - it made me feel like my event handlers were 2nd class citizens and I had issues getting manual entry and such working nicely. I also didn't want to have to manually set my routes outside of my event handlers. If you think there's a good solution please let me know!
On to the most important question - how obscure can my pun be before people will actively avoid my library? My current frontrunner is sash-fillister
- it's a type of wooden plane that is used when making wooden window frames using traditional methods, and the most likely replacement for it in a modern shop would be some kind of router. For an informative post on how to use them and to get the totally unnecessary context, see http://eatoncountywoodworker.blogspot.ca/2012/11/how-do-you-use-sash-fillister.html
I'm planning to make sure it works well before releasing it into the wild, so don't steal my awesome name - but if anyone is interested I can whip up a quick gist or something that you could use to implement what I've got so far. Alternatively, if you think it's a totally dumb idea I'd love to hear why - most of the time there's a really good reason why the libraries I think would be fun don't exist 🙂
And if you want to get your fill of jargon that has nothing to do with programming, check out the description of them for sale at https://www.garrettwade.com/antique-sash-fillister-plane.html
I’m curious how this pans out for sure. Haven’t thought of routing as a problem in re-frame, but it could be improved
Another really great tutorial from http://PurelyFunctional.tv https://purelyfunctional.tv/guide/database-structure-in-re-frame/
Can someone point me in the right direction? I’m attempting to use bidi for routing and I’d like to switch panels when a link is clicked. On line 17 in celestial.cljs should I change my line to url-for to :universe nothing happens. At one brief point I did see an event triggered in the console but I’m running in circles at the moment. https://gist.github.com/jamalburgess/78307af1888ce9b28bb02563fa981aed
@decim not sure if this is it but this reg-sub looks at the :panel
key
https://gist.github.com/jamalburgess/78307af1888ce9b28bb02563fa981aed#file-events-cljs-L24-L27
but the property you're setting is :active-panel
https://gist.github.com/jamalburgess/78307af1888ce9b28bb02563fa981aed#file-events-cljs-L12-L15
@danieleneal hmm, thanks. That’s certainly one gaff. I updated that but still not getting the result I want. I feel I’m missing calling the subscription all together to cause an action but at the moment i’m lost as far as where I am.
is dispatch-route getting called?
The other thing I noticed (I've not used pushy so guessing here) is that your call to pushy/start! might not be happening
https://gist.github.com/jamalburgess/78307af1888ce9b28bb02563fa981aed#file-routes-cljs-L26-L27
this is in a function but it doesn't look like this function is getting called
it looks like pushy/start!
is a side effecting step that sets up the route handling thing, so will need to be called from wherever you do your initialization and mount the app
@danieleneal you may be correct there. I haven’t added pushy to core.cljs. That makes sense… Or rather I just threw it in routes.cljs. It really should take place in core.cljs
@danieleneal sweet, getting there. It didn’t flip to the correct panel yet BUT it did update the db. I should be able to work it out from there. Thanks man.
great!
@danieleneal thumbs up works 100% now!
where are you calling pushy/start
from now?
(defn ^:export init! [] (rf/dispatch-sync [:initialize-db]) (load-interceptors!) (mount-components) (pushy/start! (pushy/pushy routes/dispatch-route routes/parse-url)))
@decim if you want a working example, I have this on my GitHub: https://github.com/manuel-uberti/boodle
so odd…so i moved it..reevaluated and it updated the panel. though now the links still aren’t working. getting closer though. @manuel ahh! thank you! i’ve been looking all over for a bidi/re-frame example!
hi. I Have TextInput element which update ok when typed, bet when text is changed vie subscribe it wraps text, bet number of lines stais the same. how to force it to recalculate it's "(.-height)"
That depends, do you want your area of text input (note that I didn’t say TextInput nor TextArea!) to grow vertically along with the growing number of lines?
I bet it’s much more of a hassle than to use a scrollable textarea, btw. Googled it a little bit, think the following could be converted to reagent with some love: http://www.brianchu.com/blog/2013/11/02/creating-an-auto-growing-text-input/
some more if you like http://metosin.github.io/komponentit/