This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-12
Channels
- # beginners (85)
- # boot (7)
- # cider (7)
- # clara (1)
- # cljsrn (49)
- # clojure (85)
- # clojure-dev (19)
- # clojure-dusseldorf (15)
- # clojure-greece (1)
- # clojure-italy (12)
- # clojure-nl (4)
- # clojure-russia (21)
- # clojure-sanfrancisco (1)
- # clojure-spec (25)
- # clojure-uk (59)
- # clojurescript (29)
- # core-async (5)
- # core-matrix (1)
- # css (1)
- # datomic (1)
- # docker (10)
- # fulcro (12)
- # graphql (21)
- # hoplon (7)
- # jobs-rus (6)
- # jobs_rus (1)
- # lein-figwheel (1)
- # mount (5)
- # off-topic (6)
- # om (4)
- # onyx (8)
- # perun (1)
- # portkey (25)
- # protorepl (7)
- # re-frame (78)
- # reagent (24)
- # ring-swagger (32)
- # rum (3)
- # schema (1)
- # shadow-cljs (122)
- # spacemacs (3)
- # specter (2)
- # sql (1)
- # testing (1)
- # uncomplicate (2)
- # yada (14)
what is a better way to get data from the server on page load, than using component-did-mount
lifecycle? I’m trying to avoid using lifecycles.. they make me cringe in re-frame environment
@bravilogy perhaps I misunderstand but couldn't your dispatch your event after :initialize-db
?
@bravilogy always check on re-frame docs first, you don't need to mess around with lifecycle at all https://github.com/Day8/re-frame/blob/master/docs/Loading-Initial-Data.md, https://github.com/Day8/re-frame/blob/master/docs/Talking-To-Servers.md
yeah I was looking around that page, but couldn’t find the on-load example and I was sure I could avoid using lifecycles
and then I noticed how the initialisation was working and added that bit to google and voila!
damn it’s so satisfying to write scalable code.. I know I’m still at baby steps, but adding a bit of functionality is literally adding a few additional tiny functions
makes me want to rewrite my portfolio website in Clojure, which is currently written in Laravel + React. Probably worth doing it purely for practice
I'm sure, @bravilogy working with only pure function and immutable data feel so much relief
yeah definitely. now I need to get my head around routing, server-side Clojure aaand I think I’ll be good to go 😄
been hoping to see a full-stack with re-frame, still looking..., otherwise, re-frame is simply best for frontend work
I was looking for full-stack re-frame too, but then I realized that the heart of re-frame is managing the DOM by maintaining a shadow version of it, so it doesn’t really make sense on the server (assuming you’re not rendering pages there).
I’ve been looking at the CQRS pattern in general, and Pedestal in particular, because I think that’s closer to what it is about re-frame that sounds so appealing server-side.
no @manutter51 I never meant to have a server-side re-frame, I was only hoping to see a great full-stack with re-frame as frontend
yes, CQRS is kind of natural fit although it's remained to see a case on production
on #duct , @rickmoynihan shared endpoint of lacinia-pedestal, which I find the subscription is like match in heaven with re-frame 🙂 http://lacinia-pedestal.readthedocs.io/en/latest/subscriptions.html , although I find websocket is overkill
yeah kinda annoying that it uses websockets…. I think it would be better for my purposes if it used SSE’s
yes, SSE is much better since it's standard HTTP, although SSE connection isn't that stable, not for critical use case anyway. Looking forward to JSON Streaming for sure http://oboejs.com/
@bravilogy this may help: https://github.com/Day8/re-frame/blob/master/docs/FAQs/PollADatabaseEvery60.md:
@manutter51 I believe the heart of re-frame is the discipline it imposes around state management. A discipline which is both effective but surprisingly flexible. The flow of state from app-db
to views is *a part* of that, as you propose.
But just a part
Yeah, I was sloppy in how I phrased things, you said it better.
I was referring to re-frame existing on top of reagent, which sits on React, which is a DOM management system
So re-frame is a discipline that I wish I could use everywhere, and it’s currently being applied in this specific area.
Hmm. I'd still say it a bit differently. The stack you refer to is about the 'V' (view) part of the traditional MVC. So, yes, re-frame incorporates that but there is more going on than that (covering the parts normally called M and C).
perhaps someone here knows how to use garden
? not a single example shows how to attach styles to dom elements 😞
@bravilogy You may have the wrong idea. Garden allows you to create CSS. You then attach that CSS to elements as normal. Via classes etc.
@mikethompson That’s fair. I’m trying to say something like, “Re-frame doesn’t really apply to server-side/non-client code because __“. But of course, I’m assuming that’s a valid thing to say. I’d be interested to hear your thoughts on how re-frame would apply to server side stuff, or if it would.
@manutter51 This question does come up a bit. I've captured my minimal opinion here: https://github.com/Day8/re-frame/blob/master/docs/FAQs/FullStackReframe.md Sorry, that's all I have
Ok, that’s roughly what I was thinking (however badly I may have expressed it :D)
I hope the links help. Bobby Calderwood's talk is quite useful.
I started looking at Kafka-based stuff, and IIRC the Kafka docs recommend running on machines with 32GB of RAM, which is a bit rich for my blood.
Yeah, I saw Bobby Calderwood give a version of that talk at Abstractions, it was excellent.
Our current solution is to use CQRS without Event Sourcing. So we don't do the entire Kafka thing.
Interesting
We've also experimented with rethinkdb and its live-queries acting like subscriptions
I guess Kafka is really geared towards big distributed cloud-based stuff, so for lesser stuff you don’t need the full power Kafka provides.
But then rethinkdb went out of business
could redis pub/sub work for something like that on a sub-Kafka scale?
Sure. via websokets. Or firebase
I'm so pissed off that rethinkdb fell over
(commercially)
Great product
@manutter51 Also https://yogthos.net/posts/2016-11-05-LuminusPostgresNotifications.html
is it possible to use the value of a subscribe in a event-db handler? does that make sense at all? I ask this because I have a subscribe handler that listens to the position of the mouse. Later, in an event, I need to get the latest value of this. Now technically i can cache this all in the app-db, but for more complex subscriptions (that depend on other subscriptions, ie. do sorting, filtering etc.) i sometimes want to listen to a subscribe value from within an event handler. Haven’t thought it through completely if this would mess things up 🙂 Any advice?
I could of course just try it, but kinda wanna make sure i’m not committing unforgivable sins 😉
I kinda feel that this is not going to work since the fn is run all the time, and would re-subscribe it basically.
but come to think of it i would love to be able to get a value from a pretty complicated subscribe that does collision detection of divs (working on drag/drop stuff) I could listen to the value of the sub and re-insert it through a dispatch as an argument, of course, will do that for now.
@kah0ona there is a library somehwere which provides an inject-sub cofx for use in handlers
it has the mike seal of approval too 😄
https://github.com/vimsical/re-frame-utils/blob/master/src/vimsical/re_frame/cofx/inject.cljc
there is re-frame utils too? thanks @danieleneal
@danieleneal just tried it, and it works like a charm! Very cool
great!
yeah I was really pleased to discover that library - just two functions but both fill in the little gaps in reframe at the edge...
've got a problem with a JS object in app-db not triggering a rerender. Is this a common problem? Or is it more likely that I'm misusing forms 1 and 2, and not that it's a nested value in a JS object thats being modified?
@kah0ona See the FAQ: https://github.com/Day8/re-frame/blob/master/docs/FAQs/UseASubscriptionInAnEventHandler.md
@nolan330 putting js
data into app-db
probably won't work. You won't get proper =
checks.
Ok, got it. Yeah after staring at it blankly for longer, its obvious why I was having an issue.
Incredible how effective that technique is. Thanks for the input! @mikethompson