This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-06
Channels
- # architecture (25)
- # bangalore-clj (1)
- # beginners (21)
- # boot (45)
- # cljs-dev (38)
- # clojure (272)
- # clojure-austin (7)
- # clojure-finland (7)
- # clojure-france (3)
- # clojure-italy (7)
- # clojure-japan (1)
- # clojure-russia (13)
- # clojure-spec (36)
- # clojure-uk (31)
- # clojurescript (96)
- # core-async (15)
- # cursive (16)
- # datascript (3)
- # datomic (97)
- # emacs (107)
- # hoplon (16)
- # jobs (9)
- # keechma (1)
- # luminus (1)
- # off-topic (19)
- # om (39)
- # onyx (15)
- # pedestal (3)
- # planck (22)
- # protorepl (4)
- # re-frame (20)
- # reagent (3)
- # ring-swagger (25)
- # specter (26)
- # test-check (19)
- # testing (1)
- # untangled (381)
hello guys, little React/om question -
consider this react-native component in js
:
const AppText = ({ children, style, …rest}) => (
<Text style={[globalStyles.COMMON_STYLES.text, style]} {…rest}>
{children}
</Text>
);
How do you find this om
translation :
(defui AppText
Object
(render [this]
(let [[{:keys [children style]} & rest] (om/props this)]
(text (merge {:style style} rest)
children))))
(def app-text-comp (om/factory AppText))
Is it a valid approach to include namespaced keywords in a query and filter them out of the ast in the parser, before sending to remote? Something is going wrong somewhere... Would it be preferable to filter out those keys on the backend?
@danielstockton I think it is, and actually, Untangled does just that with the ui
namespace
I think it's preferable to filter on the client, this way you can avoid wasted bytes on the network
I copied untangled using ui too. ast looks good but it seems to have broken my query somewhere
I updated query and children on the ast
@foobar if you want to change the query, there is om/set-query!
and om/update-query!
. A common gotcha is the component/class confusion. For both set-query!
and update-query!
, you’d need to use the component instance. (usually this
)
I am trying this from outside the component right now, so I would like to get a ref from the reconciler
@foobar if you have access to the reconciler, I would do something like this: (om/class->any reconciler SomeComponent)
@foobar if you’re using DataScript you’re not gonna be able to use set-query!
so it’s kinda pointless to solve the ref problem
I was assuming that I could change the query for my component and have my read function doing the lookup in the datascript db
you can change the query for your component, just not with DataScript. that’s a current limitation https://github.com/omcljs/om/issues/834
I'm just curious why this isn't fixed already. Or are you just waiting for someone to PR?
@foobar you can use DataScript right now provided you don’t use dynamic queries
the issue is easy to solve once we have a plan on where to store the component queries
@foobar is there any reason why you want to use a query? You can just store it as application state.
*query param
oh wait, you never said you were using query params
although i can’t imagine why else you’d want to use set-query!.
Please could you describe how the component 'tree' works at the moment? Is there actually such a thing? I guess that they way I would do it is to add a parameter to the reconciler and pass it a function to use to resolve components. For me it would seem that If I could construct a component with a unique ident I could use that in the function I supply to lookup a ref to the component. In a similar way creating an instance of a component could also call a user supplied function and add itself to whatever the users representation of the component tree is.
I wanted to dynamically create a child component. Adding the data to the (Datascript) state is simple. Updating the query of that state so that the relevant component knows it has a new child is not trivial.
If set-query worked then one could change the parents query so that the data can be passed to the new child
@foobar Hang on, I’m busy at the moment, will get back to you when I can. Though I think @anmonteiro is ultimately more qualified to help you. 😉
Is https://www.youtube.com/watch?v=MDZpSIngwm4 david’s most recent om next talk?
Just watched it. That was a damn good talk.
7h3kk1d: I initially read this as “Hick eyes que” Whatever that means. lol