This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-26
Channels
- # arachne (4)
- # beginners (70)
- # bigdata (1)
- # boot (373)
- # braid-chat (3)
- # cider (4)
- # cljs-dev (10)
- # cljsjs (6)
- # cljsrn (27)
- # clojars (11)
- # clojure (114)
- # clojure-austria (1)
- # clojure-czech (2)
- # clojure-dusseldorf (2)
- # clojure-greece (7)
- # clojure-italy (2)
- # clojure-nl (6)
- # clojure-russia (15)
- # clojure-serbia (11)
- # clojure-spec (92)
- # clojure-uk (5)
- # clojurescript (183)
- # component (9)
- # cursive (28)
- # datomic (36)
- # editors (4)
- # emacs (1)
- # garden (11)
- # hoplon (155)
- # lein-figwheel (7)
- # mount (47)
- # om (97)
- # onyx (25)
- # proton (3)
- # rdf (3)
- # re-frame (80)
- # reagent (9)
- # ring-swagger (9)
- # spacemacs (1)
- # untangled (145)
- # vim (2)
@anmonteiro Why are the static methods explicitly checked for as in https://github.com/omcljs/om/blob/master/src/main/om/next.cljc#L318?
With a more permissive filter, you can let users extend their components with things like static IStyle
. This will allow one to have colocated styles and generate stylesheets during compile time instead of runtime. :thinking_face:
static IStyle, interesting. I need to find some new way of doing css with react components, since I use often material design, that have some many nested styling properties that css stylesheet cant target. So I end up writing clojurescript code that is 50% :style #js {..bla...} , bit ugly.
Has someone here implemented cljsjs.react-OnClickOutside? It seems to want to take in a react class, in other terms, I could then only give it a component as parameter but not element?
@levitanong: I was under the impression that it worked
Definitely unintended if it currently doesn't
@anmonteiro the server side version explicitly looks for IQuery, IQueryParams, and Ident. When I add my own protocol, it鈥檚 absent from the meta
@hlolli Have you tried implementing the feature from scratch? You can just add a window listener on mount to call some close fn
when isDefaultPrevented
, then .preventDefault
on the component/element itself.
no haven't tought of that, was considering doing event listeners on all except the dialog I want to prevent the behaviour on. Simple problem, but tricky to solve. Is .preventDefault a native js function?
ok, I found documentation about preventDefault, thanks for pointing this out, I see where this rabbit hole leads. But still curious to know how one would implement cljsjs-onclickoutside in OM. The docs look like this
// load the HOC:
var onClickOutside = require('react-onclickoutside');
// create a new component, wrapped by this onclickoutside HOC:
var MyComponent = onClickOutside(React.createClass({
...,
handleClickOutside: function(evt) {
// ...handling code goes here...
},
...
}));
Looking like onClickOutside is a function to be called with js/onClickOutside, but that wont work. (actually the extern is OnClickOutside, to be percise).I may guess I need (js/React.createFactory (js/React.createClass like with om.dom/wrap-form-element
, I give that a try.
Hang on, making a snippet
no prob 馃檪
lemme know if you run into any trouble
@peeja just had a realization about a question you asked a while ago: http://stackoverflow.com/questions/37926569/should-component-functions-in-om-be-called-directly/39490407#39490407
@levitanong I guess I need to look further. After looking into .preventDefault and .stopPropagation, then they do work when I add them as special event listeners on specific dom target (on one document other one on dom that I want to prevent), but when happens instead is that the onClick Events that I do want to fire, are as well counted as "default". (sorry for the rest here about this bit offtopic discussion).
What I do is I place the .preventDefault in the outermost container of whatever needs to be immune to click-out. Anything inside it will be unaffected.
@anmonteiro Should I make an issue for the static protocol thing?
@levitanong probably, so I don鈥檛 forget
thanks
@anmonteiro Oh, sweet! Thanks for the update! I'll give that a try.
hello people, I noticed here that when a React component triggers a state update (think a non Om component), their children seems to lose the Om Next properties, making impossible to access the reconciler from those at this point
here is an example code:
on the first render the reconciler
is correctly logged, but when the state is updated the render logs nil
should I expect to lose the props on this situation?
Dont know how it works with js arrays, but you would at least want to implement read (static om/IQuery) on InnerElement. To read the keys being passed from react-container.
@wilkerlucio you shouldn鈥檛 expect that to work, no
shameless plug: https://github.com/compassus/omify
should probably work with ^
if you omify your plain React component
@anmonteiro thanks, I'll try that, currently my use case is trying to integrate the new React Router v4 into my app, it has a container <Router> element that does state transitions when the page changes, other than that their new approach to routing works very nicely with Om 馃檪
@wilkerlucio I鈥檇 be interested in seeing a snippet of integrating RRv4 with Om Next
even though I don鈥檛 think it鈥檚 really a good fit for Om Next apps
let me show you what I'm currently doing:
I have this om-match
that wraps RRv4 match
, the major difference is that besides changing the component, it also triggers a change into the parent query
then the component with the pages looks like this:
@anmonteiro why you think the RRv4 is not a good fit for Om?
@wilkerlucio the way I see Om Next is that you have all your data separated from the UI
your render functions should be pure functions from your data -> rendered DOM
with RRv4 you鈥檙e just conflating everything
testability goes to hell
also, the moment you鈥檙e tying your business logic to the view logic, you鈥檙e losing the ability to just swap other views in and out
@anmonteiro I'm not sure if it's possible, but what if we could just integrate the router state into the app state? it seems to be just about listing to it and converting into data at the app state, maybe creating a new custom Router (they have a few of those available on RRv4)
I just really like their new approach, seems so much simpler to use and understand IMHO
@dnolen OK to request one more alpha after you review those 3 outstanding PRs?
@anmonteiro yes will try to get to that later today
awesome, thanks
@peeja https://github.com/compassus/compassus/commit/68d67309488fe2a5a0d80add7cb2c0a7e82c9cbb 馃帀
let me know if you want me to cut a pre-release or something
still a few things that I got planned before actually cutting a proper one
@anmonteiro Sweet!
We should be good with some workarounds until you're ready to release for real, no need to cut a pre-release. Thanks, though!
@peeja currently thinking about hooking :history
into 2 separate mixins
basically :will-mount
and :will-unmount
since :history
is currently not specific at all to history 馃檪
also happy to hear more feedback
@peeja btw all your Om workarounds should be obviated by this new release ^
mostly driven by the bugs you found recently 馃槃
Anyone seen any "incomplete alias created for namespace" warnings when upgrading to alpha45? I haven't drilled down into what's causing it, but I can confirm that the commit that the warning starts showing up with the server-side rendering support commit. No change in my application code.
The full warning is
WARNING: ...resources/public/js/prod/cljs/analyzer.js:4698: WARNING - incomplete alias created for namespace cljs.spec
var mchk = (function (){var and__54983__auto__ = cljs.spec;
^
@grzm probably driven by also upgrading CLJS?
weird. same in alpha46?
@grzm oh, only under advanced?
hrm, I wonder if it happens in CLJS 1.8.51
(last release before incorporating cljs.spec)
Could be something that鈥檚 not completely baked into ClojureScript yet
or maybe you鈥檙e actually using cljs.spec
and cannot test that 馃槢
Interesting that I'm seeing it with the om upgrade. Some sort of weird interaction, I suppose
Pretty small test case: https://gist.github.com/grzm/0d2db1d1364daeb6118b610c2fc60178
Kinda surprised a script that doesn't do anything even compiles to something that isn't empty 馃檪
@grzm seems like a CLJS compiler problem https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/analyzer.cljc#L2666
can you repro without Om?
maybe with a .cljc
file, IDK
probably worth raising a JIRA in anycase
Maybe, but I'm at a loss as to how. I don't know what in the server-side rendering commit is triggering the warning. Taking om.next out of the require makes the warning go away.
@grzm right what I think changed was moving from a .cljs
and .cljc
files for the om.next
namespace to a single .cljc
file
but I have no concrete evidence that鈥檚 what caused it since the commit was a pretty big change