This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-17
Channels
- # announcements (2)
- # aws (7)
- # beginners (46)
- # cider (15)
- # clj-kondo (24)
- # cljs-dev (3)
- # clojure (46)
- # clojure-dev (34)
- # clojure-europe (7)
- # clojure-italy (7)
- # clojure-nl (10)
- # clojure-norway (15)
- # clojure-spec (5)
- # clojure-uk (42)
- # clojuredesign-podcast (1)
- # clojurescript (79)
- # clr (3)
- # core-async (1)
- # cursive (45)
- # data-science (1)
- # datomic (4)
- # fulcro (17)
- # funcool (14)
- # gorilla (2)
- # graphql (30)
- # jackdaw (5)
- # jobs-discuss (8)
- # joker (4)
- # lein-figwheel (1)
- # off-topic (48)
- # pedestal (26)
- # re-frame (36)
- # reagent (18)
- # reitit (6)
- # remote-jobs (4)
- # shadow-cljs (115)
- # tools-deps (62)
- # vim (12)
hi, i have a weird issue where the chrome network tab shows that a 303 was returned along with a 'location' response header to an XhrIo ajax call. yet the XhrIo object itself has a status of 200 and the 'location' response header is missing from .getResponseHeaders
on the same XhrIo response object.
[to complicate matters there are two layers of abstraction between myself and XhrIo: re-frame-http-fx & cljs-ajax.
[but i installed an interceptor in the latter and should have had access to the unmolested XhrIo]
I think it's followed automatically. Maybe you don't see the request that returns 200 due to some filter in the Network tab (or it very well may be a bug in the Network tab - I've seen plenty). More details: https://stackoverflow.com/questions/3820663/is-it-possible-for-xhr-head-requests-to-not-follow-redirects-301-302
ah, that could be it. in this case, i don't want the AJAX call to follow it automatically. we need to redirect the user's browser to that location, not merely a bkg request.
is there a way to tell reframe, ajax or goog.xhrio that they should not follow this one?
It's all there, just read the answers at that link: "There isn't, this isn't exposed behavior you can stop".
Does anyone know of a public ClojureScript project that uses cljsbuild and Leiningen to run tests defined using cljs.test/deftest, that I can look at as a working example?
:refer-macros
is old stuff, right? No longer needed?
@roklenarcic depends on how the macro itself is created. if it has the necessary setup then :refer-macros
is not required yes
hm... not sure what that means, but I'm trying to use go-loop async
@roklenarcic (:require [cljs.core.async :refer (go-loop)])
if you have the latest core.async
Any ideas why my src/data_readers.cljc
file is also read as a normal clojurescript file, and thus fails with No such namespace: time
for my {time/inst ...}
reader literal? Trying to quote the symbol doesn't help, because then the actual data-readers code complains about the quoted symbol.
@plexus Thank you, that helped. That was a much better ending to my work day than I had anticipated. 🙂
either way, I'm a bit further, so I can experiment some more with the class path shenanigans.
what you can also try (hax0r warning), is prefixing the symbols with ^:cljs.analyzer/no-resolve
also don't use data_readers.cljc
in the first place. just configure your reader properly at runtime.
don't use data literals in code, unless you want to suffer through all sorts of weird issues with caching and so on
that's true, but trying to read data literals in code is due to a few other issues 😛 we have regressions tests, and since the clojurescript compiler only watches for .cljs and .cljc-files for reloading, we put the regressions test data in a .cljc-file - instead of an .edn-file. And so we are here.
but your advice seems sound - we'll have to move the regression test data out to .edn again, and find some other way of keeping it up to date.
shadow-cljs has this to deal with that problem https://clojureverse.org/t/using-none-code-resources-in-cljs-builds/3745
another option is just running an external file watcher that runs touch src/test/my/tests.cljs
on change
hey, I’m trying to update an old project from cljs .439
to .520
and getting a compilation error message with no context. is there somewhere that compilation logs can be seen..?
Failed to compile build :ios from ["src" "env/dev"] in 6.549 seconds.
---- Could not Compile src/foo/bar.cljs ----
failed compiling file:src/foo/bar.cljs
---- Compiler Error : Please see src/foo/bar.cljs ----
what are you using to build? seems weird that the error is missing? or are you just omitting the stacktrace?
Can someone recommend me a nice UI table component? I need a table that keeps column and row headers and can scroll the data if rows and columns are bigger than the viewport.
I am using material-ui (react library): https://material-ui.com/components/tables/#sorting-amp-selecting for tables and bunch of other stuff
`(defn my-table "material ui table headers: vector [field-selector name formatter linker] rows: the seq to be displayed as a table" [headers rows] ; [mui/paper {:square true ; :style {:background-color mui/secondary ; ;; :text-align :center ; :padding "0em 0em 0em 0em" ; :width "100%"; "400px" ; :marginTop "10px" ; :overflowX "none" ; :overflowY "none" ; } ; } [mui/grid {:container true} [mui/grid {:item true :xs 12} [:div {:style {:overflow-x "auto" :overflow-y "auto" }} ; Fixes overflow outside screen [mui/table ;; Headers [mui/table-head (into [mui/table-row] (for [field headers] [mui/table-cell (get field 1)]))] ;; Body (into [mui/table-body] (for [row rows] (into [mui/table-row] (for [field headers] [mui/table-cell (get-field-data field row)]) )))]]]])`
if its just for display and don’t need any interaction, then you can get quite a long way with just html & css
react-virtualized
@U0FR82FU1 thanks - I will try that
hi, does anyone know how i can read the data attribute of a dom element via cljs?
or how can I use getAttribute?
anyone ever extend a protocol onto js/DOMRect
and js/MouseEvent
for top
and left
so it looks more uniform rather than (- (.-clientX e) (.-left X))
? Is this pointless, or maybe has pain later on, or is this kinda what its made for?
I like the fact that inerop code looks like interop so I might not want to reach for this. Did you have anything else in mind other than aesthetics?
yeah it was to make the math seem a bit more straight forward. but there were better ways around it. but it was principally aesthetics
its quite simple but really its just property access so i'm wondering if the uniformity is trumped by the added indirection
i can't understand what's going on in this code i wrote. basically, i want to make a request and throw some error JSON if the response wasn't ok, but i'm getting all tangled up in promises. would someone be willing to take a look with me?
or maybe throwing for a successful but non-200 response isn't the right thing to do? i'm not sure of the conventions in this domain
I made this code. Not sure if this is good code or not. I have build a dashboard with multiple components that all get passed a symbol for which they should get data. The components manage the fetching of the data they have to get. Now in order to trigger reload on change, I made this function. I basically make a function that does not return anything visible, but does trigger the api reload. The nice thing is that my components can be normal Level2 components with easy syntax, and I avoid the more complicated syntax.