Fork me on GitHub

When is it ok to write dotted expressions eg. js/document.alert and when should I use (.alert js/document)? I have a vague feeling there are situations with callbacks and this where it matters, but possibly not otherwise. Is anyone aware of docs on this?


I personally use the js/document.alert variant only when accessing globals. ie. only with js/* or other namespace aliases (eg. (:require ["something" :as x]) (x/ anything involving locals (eg. this) I only use (.whatever this) variant, so "proper" interop that would work in clojure too.


still struggling with open layers in clojurescript, tried just about every style of import from the shadow docs but still get XYZ is not a constructor starting to wonder if the node module is even correctly included in my build is there a way to check that its correctly included in the generated javascript ?


just try logging and see what you get


"is not a constructor" likely means that it is undefined and you are just using the wrong thing


okay thank you I will give that a try a bit later spent a few hours trying all sort tried with shadow and figwheel ended up getting no where trying all sorts of combinations of the import statements last night,


note that there may be differences in shadow and figwheel in case you use figwheel with cljsjs


figwheel + webpack should be same as shadow-cljs


also note that it is not uncommon in JS to completely change how a library is used inbetween versions. so make sure the docs you are following match the version you actually use


if you want to setup a repo with a problem I'm happy to take a look at what might be wrong


that will likely be my next step to create an example in isolation if nothing else it maybe useful to others 🙂


Okay I cloned the shadow quick start added ol and tried to create an instance of XYZ which is enough to see the error I mentioned


didn't I tell you that this is wrong? ["ol/source/XYZ" :refer [XYZ]]?


probably needs to be ["ol/source/XYZ$default" :as XYZ]


cloning that repo gave you a rather outdated shadow-cljs version. you should bump that. otherwise $default won't work there


I bumped that template to the latest version


okay yeah you did say that I tried them all before but as this was a new repo I just used the layout I have seen others use, I don't think I tried the $default one though at least not in that format perhaps I misunderstood that I shall give it a try and report back


okay that does appear to work, sorry for wasting your time not sure I get $default but perhaps I need to read up on what that does, I will try on my bigger project a bit later. Thanks for taking the time to guide me 🙂


oh thanks for that link that's cleared up a lot 🙂

oliver marks20:05:01

@U05224H0W thanks again for the help got there in the end, got a reagent component with update working here so very pleased with that 🙂

👍 1
Muhammad Hamza Chippa12:05:07

I am using AntSlider in my clojurescript UI and applying reframe dispatch function on-change but the slider loses focus on every change this is what I am doing in my UI. What I am doing wrong in that?

[:> Slider {:min 0
                   :max MAX_ENGLISH_LEVEL
                   :value @english-scale-atom
                   :on-change (fn [number]
                               (rf/dispatch [:apply-filter-english-proficiency number]))
                   :tip-formatter nil}]]]


Try using rf/dispatch-sync instead.


If that doesn't work, add (reagent.core/flush) right after it.

Muhammad Hamza Chippa13:05:18

I have added this still losing focus

(rf/dispatch-sync [:apply-filter-english-proficiency number])


Maybe the parent component is fully re-rendered? In any case, you can use React DevTools to help you figure out what's re-rendered and why.

🙌 1
👆 1

Is anybody working on a non-react solution for doing ClojureScript? I'm redoing my site in Svelte using SvelteKit's Static Site Generation simply because I don't want a JavaScript bundle when I'm not even doing any DOM manipulation. I miss hiccup as my template language, and being able to use ClojureScript for any logic. The closest thing I've seen is shadow arborist, but I haven't seen any work done on it recently.


I also greatly desire this too. I think something like Svelte except done entirely through macros is going to be the next big thing


what about using Clojure and something like


Haven't seen this! Thanks for sharing! @U0MKRS1FX


there are probably more than a handful of static site generators for Clojure, so maybe Clojure is a better fit than clojurescript when you don't wany any JS to be involved 🙂


I believe is the fancy term for this sort of static site setup


The ones on the list here are super old, but I didn't look very far to find Clojure SSGs.


yeah maybe there's no thriving community here, I'm not sure. Statis has been serving my needs for the last ~decade or so 🙂


shadow-grove is working pretty well, just need to make a proper release and write documentation.


however server-side rendering is a complete non-goal so it won't help you there 😉


How did you come up with the names, "arborist" and "grove"? Is it because of the DOM tree? :)


@U05224H0W are there any recent examples of what arborist components look like? Specifically wanted to look at how updating state/reactivity within components looks like


a bit all over the place but those I wrote most recently