Fork me on GitHub
#clojurescript
<
2018-01-05
>
Macroz15:01:30

@madvas I'm trying to use cljs-react-material-ui package and I keep running into the react included twice problem in advanced optimization mode. As far as I can see it's required once in my core file and react should not be depended twice in the project. Do you have any tips on how to debug this issue?

Macroz15:01:23

I noticed there was an issue about this in the repo and various references to found while googling but no definite solution

uwo16:01:22

any recommendations for doing currency arithmetic on the client? the computed values aren’t just for display; they’ll get saved. Typically, I’d just do this on the server, but curious if the alternative is viable.

mjo324_5616:01:19

can anybody help me how to fetch from clojurescript in a reagent environment a remote json and display it?

borkdude17:01:51

Do you need to show the raw JSON or transformed as some table or something?

mjo324_5617:01:16

@borkdude i need simply a working example; the site should fetch a json and display it's contents.

mjo324_5617:01:36

it doesn;t matter hiow they are displayed, i can go on with this then

borkdude17:01:16

Sometimes I don’t get an error message when I move a namespace to some other directory, because the structure and namespace name don’t match, but my app doesn’t work anymore. Is this a known issue? I’d rather have an error message by the compiler. This is only when incrementally compiling.

noisesmith17:01:21

@borkdude tools.namespace/refresh destroys namespaces before reloading code, and thus would make this show up as an error immediately

juhoteperi17:01:50

tools.namespace doesn't really work with Cljs 😉

noisesmith17:01:05

ugh! I keep forgetting which channel I’m in, sorry

juhoteperi17:01:41

One thing that might affect this is that Cljs compiler doesn't remove removed files from compiler cache

juhoteperi17:01:03

Though, in that case the app would be working, as it would still use the old namespace. More specific test case would help on understanding what happens.

borkdude18:01:38

I notice I can reproduce it on first compilation by using the wrong namespace name in a file, e.g. /src/foo/bar.cljs with (ns foo.bar2) instead of (ns foo.bar). It won’t produce an error but causes unexpected behavior. I’ll have to test this in a mini project

dnolen20:01:09

@borkdude one problem is that ClojureScript was originally file system oriented

dnolen20:01:25

you compiled a source directory and structure of what was in there didn’t matter

dnolen20:01:57

but you also have cases where it’s not going to match

dnolen20:01:22

Google Closure style JS libs, ES6 stuff

dnolen20:01:03

one thing worth mulling over is whether should be some kind of strict mode where ns names of CLJS sources must always be correct with respect to file system location

borkdude20:01:46

Yeah, or at least a warning from the compiler if it detects an inconsistency with cljs file structure?

dnolen20:01:35

we do warn of course

dnolen20:01:42

just not for stuff directly under src

dnolen20:01:53

the directory you want to compile

dnolen20:01:00

one way to avoid this is always use :main

dnolen20:01:30

so you’re not compiling random stuff, but only things reachable via require

dnolen20:01:45

and then you’ll get all the warnings you want

dnolen20:01:51

unless you name :main itself badly

borkdude20:01:53

I’ll try that

borkdude21:01:15

@dnolen ah, in our case what happens is this: hello-world/core.cljs

(ns hello-world.core
  (:require [hello-world.foo]))

(enable-console-print!)

(println "Hello world!")
(#'hello-world.foo/foo)
;; no warning
hello_world/foo.cljs
(ns hello-world.foo2)

(defn foo []
  (println "o no"))

borkdude21:01:42

we need the var for reloadability

borkdude21:01:34

but even without #' I don’t see a warning.

borkdude21:01:46

that is, with a fully qualified name

dnolen21:01:13

@borkdude oh that’s a different problem than what I expected

dnolen21:01:22

if the file is in the write place with the wrong namespace

dnolen21:01:29

open a JIRA ticket for that please

borkdude22:01:50

I could not select version 1.9.946 in Jira, so I selected the latest I could find