Fork me on GitHub
#clojurescript
<
2018-01-16
>
deadghost00:01:16

hmm well now I'm starting to suspect ! in handler names are no good

deadghost00:01:29

well ! seems fine

deadghost00:01:02

db just doesn't get passed for ??? reasons {:event [:http/delete-contact!--success "7v13J9n" nil], :db nil} <- cofx map

deadghost00:01:31

ok I find the problem

deadghost00:01:03

I used a reg-event-db and didn't set a db so it was getting lost earlier in the chain

mikethompson00:01:51

@deadghost these kinds of problems get caught nice and early if you create a spec for what's in app-db and check it after every event handler has run:

mikethompson00:01:04

BTW, there is a #re-frame channel to reduce noise here

eremec06:01:57

Hello, I have a single page web application with reagent and client side routes, but on first load website opening a noticeable slow. I have many cljs namespaces compiled in one file, so, is there any way to not download all namespaces at once and bound them with client side routes?

val_waeselynck08:01:34

Also make sure you have done the basic steps to avoid loading too much - advanced minification and gzip

p-himik06:01:49

@eremec I have not yet used it, but this appears to be what you're looking for: https://clojurescript.org/news/2017-07-10-code-splitting

Casey17:01:14

How does one embed svg files inline in the dom?

Casey17:01:28

I want to embed an svg file inline as a dom element, so I can dynamically style it

grzm18:01:01

@ramblurr My first attempt would be to slurp the file and using inner-html in some manner, I think.

lilactown18:01:49

what are some cons to building a large website using cljs (and using e.g. macchiato?)

noisesmith18:01:29

the tooling and development workflow around cljs is more fragile and less mature than jvm clojure, and a node http server running cljs code will require more hardware resources for equivalent performance to a java process running clojure code

noisesmith18:01:33

or maybe a clearer way to put it: less developer convenience and more hardware costs

lilactown19:01:27

gotcha. that makes sense @noisesmith and matches my experiences

lilactown19:01:24

there’s a push on my team to use AWS Lambda and so I’m trying to figure out how that affects the value prop of JVM vs Node.js

noisesmith19:01:06

@lilactown there was a great, detailed comparison of using jvm clojure vs. node clojure in aws lambda in the last clojure/west

noisesmith19:01:18

complete with a four way graph (latency vs. cpu usage / jvm vs. node) where he showed with measurements that if you need low latency and also your task is low load, node wins, but for all other combinations (including low latency plus high CPU usage) jvm clojure wins

noisesmith19:01:08

@lilactown link to the vid (directly to the slide I mention) - the whole thing is worth watching though https://youtu.be/GINI0T8FPD4?t=44m16s

noisesmith19:01:19

(chart isn’t exactly as I remember it, but the important information is all there)

noisesmith19:01:41

all that said, if you need to do a specific thing that’s easy in node but hard to do on the jvm, that might be a deciding factor

lilactown19:01:42

nice. yeah, perf is one aspect

lilactown19:01:15

one thing I do want to do is server rendering of our reagent components

noisesmith19:01:33

I hear rum has much better integration of server rendering fwiw (I have not used rum so this is hearsay)

lilactown19:01:16

I tried Rum, but some pretty serious bugs and the ability to use re-frame drove me to choose Reagent instead

ajs21:01:28

rum is very cool but i'm by default quite skeptical of api's that are heavy macros, which can be very fragile

justinlee21:01:08

@ajs but the alternative is reagent, which does a ton of manipulation of the react api and has lots of weird gotchas

ajs21:01:37

with either, you'd have to spend quite some time getting familiar to their quirks; reagent is certainly far more widely used, which offers some stability from widespread usage/reports

ajs21:01:41

I'm curious, how is it possible for there to be a string literal in my code, but that literal does not appear in the advanced optimized build. Many of the literals do show up in the compiled output, but some do not, even though those literals appear on the web page itself.

ajs08:01:06

Do advanced optimizations sometimes transform a string literal in a way that makes it unreadable in the source but still actually present?

kenrestivo22:01:03

it got optimized away?

kenrestivo22:01:19

perhaps it is dead code

ajs08:01:21

How could it be dead or optimized away if the string literal appears on the screen of the running app?

dpsutton22:01:52

has anyone ever seen this error?

clojure.lang.PersistentList cannot be cast to clojure.lang.Named

----  Exception Stack Trace  ----

java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Named
 at clojure.core$name.invokeStatic (core.clj:1587)
    clojure.core$name.invoke (core.clj:1581)
    figwheel_sidecar.build_middleware.notifications$make_sendable_file.invokeStatic (notifications.clj:81)
    figwheel_sidecar.build_middleware.notifications$make_sendable_file.invoke (notifications.clj:78)

noisesmith22:01:16

@dpsutton there’s a few ways to get that, here’s a simple one

=> (name ''foo)

ClassCastException clojure.lang.PersistentList cannot be cast to clojure.lang.Named  clojure.core/name (core.clj:1546)

bronsa22:01:40

check for e.g. (ns 'foo ..)

dpsutton22:01:41

sorry. it's in figwheel sidecar.

noisesmith23:01:00

yes, the stack trace says so 😄

dpsutton23:01:26

bronsa super close but you get this one. in my haste i forgot the ns in the declaration. so it was just (my-name-space ...

dpsutton23:01:02

thanks so much!

ajs08:01:21
replied to a thread:perhaps it is dead code

How could it be dead or optimized away if the string literal appears on the screen of the running app?