This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-28
Channels
- # aleph (2)
- # beginners (25)
- # boot (12)
- # cider (73)
- # cljs-dev (3)
- # clojure (37)
- # clojure-dev (93)
- # clojure-germany (1)
- # clojure-italy (24)
- # clojure-nl (21)
- # clojure-russia (26)
- # clojure-spec (37)
- # clojure-uk (80)
- # clojure-za (1)
- # clojurescript (47)
- # cursive (4)
- # data-science (17)
- # datomic (69)
- # emacs (19)
- # events (7)
- # fulcro (41)
- # hoplon (14)
- # leiningen (2)
- # nrepl (4)
- # off-topic (253)
- # om (11)
- # portkey (2)
- # re-frame (11)
- # reagent (24)
- # ring-swagger (1)
- # rum (5)
- # schema (1)
- # shadow-cljs (106)
- # specter (2)
- # tools-deps (91)
is there an easy to get the browser viewport size in cljs? I'm guessing it's possible via google closure, but the docs were confusing
nevermind, i got it working
(ns ucv.ui.pos.screens.vehicle
(:require
[fulcro-css.css :as css]
[fulcro.client.dom :as dom]
[fulcro.ui.html-entities :as html]
[fulcro.client.primitives :as prim :refer [defsc]])
(:import
[goog.dom ViewportSizeMonitor]))
(.getSize (ViewportSizeMonitor. ))
it wasn't working with :require
so i tried :import
still not sure what the rule is for when to use :require
vs :import
in cljs
@U0NK86WSY check out fulcro it's a well maintained and actively used fork of Om Next http://fulcro.fulcrologic.com/
Thanks, I'll look into it. I just started with reagent and want to see how easy it is to sync client and server in some kind of push or pub/sub protocol
fulcro has a websockets component for stuff like that
hmm I hope I will not have to relearn concept to upgrade from 1.0.0-alpha34 to 1.0.0-beta1
@dnolen. The gzip'd size is much more reasonable, thanks. (It's about 350K instead of 1.5M). I'm including this library in a transitive dependency in a Luminus-based project. Offhand, I have no idea how to tell my toolchain to gzip the file. I'll search for the answer, but if anyone here happens to know the answer, please jump in.
Hey everyone, I’m trying to use material-ui in my shadow-cljs project with reagent. I’ve encountered one issue along the way that’s the thing in material-ui docs
<Dialog
fullScreen
open={this.state.open}
onClose={this.handleClose}
TransitionComponent={Transition}
>
Transition
here is specified like this
function Transition(props) {
return <Slide direction="up" {...props} />;
}
How should I present it in Reagent?
[:> Dialog {:full-screen true :open @show-login-screen? :on-close #(dispatch [:show-login-screen false])
:Transition-component [:> Slide {:direction "up"}]}
This gives me type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: array.
When I wrap it with a function, I get
Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render.
You need to set provide Transition component as React component, Reagent vector is only understood by Reagent: (r/reactify-component (fn [props] [:> Slide (merge{:direction "up"} props)]))
Answering my own question: to enable gzip in a Luminus app, see http://www.luminusweb.net/docs/middleware.html.
In short, add [amalloy/ring-gzip-middleware "0.1.3"]
to project, and call it from wrap-base in middleware.clj
@marcinszyszko another option is to omit react->reagent->react adapters completely and provide the react-component to Dialog directly in :Transition-component
and provide props with Transition-props
:Transition-component (gobj/get js/MaterialUI "Slide")
:Transition-props {:direction "up"}
Oh, that might be better maybe. As with {:Transition-component Slide}
it works perfectly, but the previous thing with reactify-component
wasn’t triggering the exit animation properly (not sure why). I’ll try your approach here, thank you 🙂
That’s exactly like described in this solved bug here https://github.com/mui-org/material-ui/issues/9116 it might still be the case in some circumstances
This approach works correctly. I used it like this
(:require ["@material-ui/core/Slide" :default Slide])
and then
[:> Dialog {:full-screen true :open @show-login-screen? :on-close #(dispatch [:show-login-screen false])
:Transition-component Slide
:Transition-props {:direction "up"}}]
I have the following require in a cljs namespace:
[secretary.core :as secretary :refer [defroute] :include-macros true]
I am trying to write a macro that will manipulate parameters used in calls to defroute.
In another clj macro I wrote I was able to detect those forms by doing a walk with a check like:
(and (list? form)
(symbol? (first form))
(= (resolve (first form)) #'defroute))
However, in clojurescript I am getting Unable to resolve var: defroute in this context
despite the fact I was utilizing defroute just fine in this namespace before adding this macro.
Is there something different about varquotes in clojurescript?I appear to be able to var quote other symbols from the same namespace (e.g. #'secretary/get-config
) it's just the macro that appears to be a problem
Ah, that explains it. How can I reliably do symbol comparison and match against various aliases such as defroute
, secretary/defroute
, and secretary.core/defroute
then?
And not cases where those same symbols have been shadowed to point to something else?
What exactly is &env
? I'm having a hard time finding examples or further documentation
it’s a magic var made available to macros about its calling environment when macroexpanding
Ah, that explains why I wasn't able to poke at it outside of a macro to see what it was
I'm still not having luck.
Should something like this print the env in which x is called? (defmacro x [] (list prn &env))
@achikin the keyword is "scoped modules". You might be running into https://dev.clojure.org/jira/browse/CLJS-2633