This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-30
Channels
- # adventofcode (4)
- # aleph (1)
- # announcements (7)
- # aws (10)
- # babashka (23)
- # beginners (23)
- # calva (20)
- # chlorine-clover (13)
- # cider (17)
- # clj-kondo (13)
- # cljfx (9)
- # cljsrn (9)
- # clojure (98)
- # clojure-australia (1)
- # clojure-dev (15)
- # clojure-europe (127)
- # clojure-nl (4)
- # clojure-sanfrancisco (3)
- # clojure-uk (98)
- # clojurescript (25)
- # community-development (8)
- # core-async (15)
- # cryogen (9)
- # cursive (7)
- # data-science (1)
- # datascript (5)
- # datomic (3)
- # devcards (2)
- # fulcro (5)
- # graalvm (1)
- # helix (8)
- # jackdaw (1)
- # jobs (5)
- # kaocha (17)
- # malli (5)
- # meander (5)
- # off-topic (37)
- # pathom (33)
- # pedestal (3)
- # re-frame (12)
- # reitit (1)
- # remote-jobs (3)
- # sci (1)
- # shadow-cljs (6)
- # testing (1)
- # vim (6)
- # vrac (5)
I am trying to create a .cljc library from a clojure library I wrote. Unfortunately this library depends on clojure.data.json
which is not available in clojurescript, is there a way with leiningen to have some dependencies only when building for clojure, and not for clojurescript? I know I can adapt the functions using clojure.data.json
using reader conditionals
> is there a way with leiningen to have some dependencies only when building for clojure, and not for clojurescript Yes, profiles.
Profiles apply at build time but as far as I know you won't be able to ship a single .cljc jar that only sometimes brings additional dependencies to the classpath. So, if your goal is one distribution then it could be without clojure.data.json and you could mention to your users that it's a required additional dependency for using the library from clojure. Or, just always include it since an inflated classpath during clojurescript builds (not distributions) is probably not very important unless the library is something prone to breaking and also used by the clojurescript build chain / compiler.
I have a table with 3000 cells, and it's taking forever to render. How can I get it to sparsely rerender when I edit one cell?
Do your cells have unique React keys? Usually, the key to solving this in React - and therefore reagent - is to make sure your cells have a unique key, i.e. the stuff you set either in the attr map or via metadata, e.g. ^{:key k} [:td ....]
. If every cell has a unique key, then only the cell with changed content needs to be modified. Also, do make sure to make all call all your component functoons with [my-component ...]
rather than (my-component ...)
.
Keys are the trickiest part of React, IMO. There is unfortunately no one good way to create unique keys; it really depends on your data. Depending on how you data looks you might have to create the uniqueness at the row level instead.
> sparsely rerender Not just for editing - consider using something like https://github.com/bvaughn/react-window
Thanks! Keys solved most of the problem. I had to use keys on all my intermediate functions in order for that to work though.
@U0125K3M73J It looks like you’re incrementing integers as your keys. Note that this will likely introduce subtle bugs if you ever reorder your data or introduce new data points since your some of your keys then no longer identify the same data points. Also, I recommend keeping your browser developer tools open while developing - that would also have notified you of your missing keys.
They did notify me. I was just confused because I thought my keys would automatically propagate through custom components. About the integer keys, i'll keep that in mind if I reorder them
Hi folks! Someone knowns the correct/proper way to rexport vars from other namespaces? I mean, some kind of reexport. A simple (def foobar someotherns/foobar)
works but does not preserves metadata and the compiler does not emit warnings on compile time about wronga arity...
there have been libraries and tools to do this in the past but only works for Clojure and generally yucky in my opinion
Yeah, I know that clojure has many libraries that does; In my case we have a very big namespaces, for mental process is much simple splitting them, but as public api, we prefer import a single namespace with all the exposed funcions... we have used simple def based reexports, but they are very weak (dont preserves metada (expected), so the compiler emits more arg checks and then does not emit arity warning...)
Hi everyone! Wondering if someone could help me with hashing build files - I understand that there is module-hash-names option for shadow cljs but how do I get that newly built hashed file name into index.html? (other than doing it manually) Thank you for any help!
@nedim hi, the shadow-cljs generates manifest file (in EDN or JSON), you can generate it in JSON and then pass the proper values to a template generation function for generate the index.html
We are doing this here: https://github.com/penpot/penpot/blob/develop/frontend/gulpfile.js#L50
I just transform the index.html when serving it. In the handler it's easy to read the manifest...
@U05224H0W Thank you!