This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-19
Channels
- # admin-announcements (1)
- # arachne (3)
- # atlanta-clojurians (5)
- # beginners (6)
- # boot (37)
- # braveandtrue (1)
- # cider (128)
- # clojars (3)
- # clojure (224)
- # clojure-belgium (5)
- # clojure-boston (43)
- # clojure-czech (8)
- # clojure-france (2)
- # clojure-greece (17)
- # clojure-hamburg (4)
- # clojure-russia (285)
- # clojure-seattle (1)
- # clojure-uk (12)
- # clojurescript (209)
- # core-async (2)
- # core-matrix (8)
- # core-typed (1)
- # cursive (2)
- # data-science (2)
- # datascript (1)
- # datomic (18)
- # emacs (12)
- # events (2)
- # hoplon (15)
- # immutant (1)
- # jobs (1)
- # ldnproclodo (23)
- # leiningen (10)
- # mount (8)
- # off-topic (7)
- # om (126)
- # onyx (6)
- # overtone (2)
- # parinfer (5)
- # proton (24)
- # re-frame (16)
- # reagent (14)
- # untangled (105)
- # yada (1)
Quick question-- is it possible to have {:remote true} after a recursive parser call? i.e. I've recursively called the parser to another :key which I would like to fetch remotely?
You only get to return one thing. :remote true means "this whole query expr". If you only want part of it, you need to return a modified ast, not true
I set :remote true for the top level keys in that "query" but nothing is being fetched
I haven't tried something like this yet, so not sure -- maybe someone else can be more helpful. But the :remote true in your recursive read only matters when :remote is passed to the parser as a third argument
You could maybe pull :target out of the env in your top read. If it's nil, do your current code. If it's :remote, then do something different, possibly passing :remote into your recursive parser call, if that's what you want
IIRC (away from repl) you get a query back? I guess maybe you'd want to put that query into the top ast's :query and return that under :remote
@tomjack: appreciate the help. I'm gonna keep messing with it see if I can get something to work. I just keep thinking it shouldn't be this hard...
(not that I necessarily recommend it -- my project will be hosted on s3 so I haven't tried it -- but the designers agree "it shouldn't be this hard" and tried to do something about it)
im having trouble getting components to rerender by ident following a mutate. Doing the following is not working [(mutate/func ...) [:something/by-id 1]]
.
I should note that that particular component's data is not normalized in any way. I'm using the ident on it solely so I can target it for a rerender.
also, I think your parser will need to return a map with the ident in it when queried something like (parser {:state (om/app-state reconciler)} [[:something/by-id 1]])
I assumed I could put an ident on a component and target it for rerenders, but I see now it doesn't work that simply.
yeah, it would seem odd to me if you had to, say, stick dummy data in there or hack the parser, in order to make follow on ident reads do something
it makes me wonder if om should pull out idents from the tx and add them to the queue
isn't that what it does? you put idents in the transaction to signal what components need to be rerendered?
(as I understand it) your follow-on reads are expanded into queries from the root (for idents right in the tx, this expansion does nothing). then the parser result contains the result of read'ing these queries, and the keys in the result are used to decide what to reconcile
so if your parser returns nil for reading an ident, the follow on read will have no effect. I should test this, though..
Is there any info about adding react plugins in Om that is not featured on cljsjs, I want to implement this lightweight popup window addon https://github.com/marcio/react-skylight would it be easy to use it in om.next?
@hlolli: Well I think you might add it as foreign library... or, I've just done this (for my purposes):
(1) Installed a list of libraries via NPM
(2) Created Webpack config file and compiled a bundle out of them. Content of the entry
file would be like this:
window.Module1 = require('Module1');
(3) Just added this bundle to the index.html
file
(4) Used that libs inside of CLJS files via js/Module1
. Done
@hlolli: What about compatibility with Om Next I think these might be just used via js/React.createElement
etc
@andrewboltachev: you still need externs no?
@martinklepsch: externs? is it sth of cljsbuild
?
Ok, so as a react.js newb, the plan is to compile the jsx files to js and load them in html page and have om refer to the js files loaded into the html document. I need to look up Webpack.
If you call js/Module1.foo() in your cljs code the compiler will "optimize" it to single letter variable names unless you provide externs (externs essentially prevent this munging)
ah sure...
ok, since Im using tenzing, the extern declarations happen inside the .edn files in resources?
@hlolli: no usually not. I suggest looking into packaging react-skylight as a cljsjs package
btw, the things I'm including this way are React and Relay (I know they have cljsjs versions, sure). I've got to the point that I can't understand Om Next anymore... 😞 Does anyone know, how to use ES6 classes like Relay.Route
?
@andrewboltachev: (the optimization will only happen with "advanced" - forgot to mention that earlier)
Yep I understand
On :none
it's ok
@martinklepsch: I will make an attempt to package this to cljsjs, at least read the manual, I've got enough material for now. So thanks Andrew and Martin.
(Also, the reason I'm trying to add them via Webpack, not via :dependencies
is that I have few :cljsbuild
profiles for client code (with figwheel enabled) and Node.js server, and :dependencies
thing is just project-wide, and I want to keep client and server isolated))
btw... @hlolli Now I think this might be an issue if this lib (using my way) would be included before React. Then, after the React and your compiled CLJS code it would be useless. So you'd better look at cljsjs solution. Though, I don't know how dependences are managed there too, but you'll probably face them when creating the cljsjs thing for react-skylight
reading cljsjs docs, it seems to me that it will be skylight to add skylight to cljsjs
I would guess that if you write your own modal stuff (cribbing some from react-skylight, maybe), it will very likely be better than react-skylight
I mean, if you start writing a modal dialog in om.next, are you going to put the modal's visibility into component-local state?
yes, it seems trivial to write this just in om.next. Maybe I make a cljsjs version for the challenge (and future knowledge of react addons available).
@hlolli: try looking at existing packages like chartist
. it's actually not a lot of work
Anyway, has anyone tried Relay in CLJS?
no, but I'd like to, doesn't om.next solve the same things as Relay would solve (just refering to dnolen's presentations).
@hlolli: May be not literally, but yes, almost the same. That's just me who's that stupid and can't use Om Next 😄
Also, David Nolen recommended to learn about Relay for one who wants to understand ideas behind Om Next better
Are there any patterns with om.next how to handle urls? do you put the url in your state or do you actually keep it out?
especially when you are using query params like ?size=20&start=40
I had just put a function that updates the url in a mutate function but quickly realised this was not the way
@mitchelkuijpers: how about parsing those to a map then pass that map as props through components ?
@nxqd: I currently use them for my queries like this:
({:companies/list ~(om/get-query EntityRow)} {:start ~'?start
:size ~'?size
:filters ~'?filters})
And then I use set-query! to set the params but I guess ill just use a computed key with :update-query-params
function or something like thatAnd give that to the child components
I think it sucks a bit because the query params should also live in my state so that you can do [:ui/query-params]
in your components
But this seems the best solution for now
@mitchelkuijpers: You might have a look at https://github.com/anmonteiro/aemette This starter kit involves very interesting approach to routing (may be for URL only, not params yet)
@mitchelkuijpers: Also, inside of a render method you might have access to query params via get-query
, may be with help of class->any
etc
Aha those are some good tips thnx
@dnolen: React 15.0.1 is out on CLJSJS. I wonder what obstacles are there for upgrading it in Om?
or is it something we should start thinking about or even doing
@anmonteiro: we should just try it
hopefully it just works - I thought I ripped out most things that would cause problems
I agree
I remember having tried RC-1
it worked fine, I believe
let me try the final one locally
and I’ll PR if everything looks great
@dnolen: I tried it mostly to test Cellophane out. There are nuances for React to pick up markups due to react-ids, I believe
but with React 15, markup gets picked up much more often
@hlolli: not quite
although React lets you use all svg elements, they haven’t created factories for them
so you’ll need to use (js/React.createElement “use” #js {props…} ...)
ok, so for so good using filter and gaussianblur in sablono (on om.next and react 15). But good to know if I hit a problem.
@hlolli: I mean React factories such as React.DOM.div
which is what om.dom relies on
@dnolen: everything looks great, devcards behavior, tests pass. I wonder if I can also align the dependencies in project.clj
with the ones in pom.xml
I remember we talking about it some time ago
@anmonteiro: yep go for it
one more thing: should we bump to CLJS 1.8.40 too?
oh right
@dnolen: just submitted the PR.
plus side is that om.core
users will also be able to use React 15