This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-20
Channels
- # announcements (16)
- # aws (1)
- # babashka (24)
- # beginners (54)
- # calva (25)
- # cider (4)
- # cljs-dev (2)
- # clojure (16)
- # clojure-dev (39)
- # clojure-europe (18)
- # clojure-nl (1)
- # clojure-uk (4)
- # clojurescript (66)
- # core-async (16)
- # cursive (13)
- # datomic (15)
- # deps-new (1)
- # duct (22)
- # fulcro (20)
- # jobs-discuss (1)
- # kaocha (3)
- # lsp (11)
- # malli (8)
- # off-topic (38)
- # other-languages (18)
- # polylith (18)
- # portal (15)
- # react (2)
- # reagent (9)
- # reitit (7)
- # releases (10)
- # reveal (1)
- # sci (13)
- # shadow-cljs (3)
- # specter (4)
- # sql (4)
- # xtdb (16)
Does anyone know how to make Firefox display the body of application/edn responses in the network tab? My edn responses come up as garble for some reason
I can confirm that Firefox Base64 encodes the response, but why? Does it think it is binary data?
Seems like this is the right issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1623503
Why can't I "save" and use js/history.pushState
?
This works fine: (js/history.pushState nil "test" "/ui/test")
While this
(let [push-state (.-pushState js/history)]
(push-state nil "test" "/ui/test"))
crashes with TypeError: Illegal invocation
I want to "save" the original function, so I can replace it with my own wrapper function.I already tried
(let [push-state (.-pushState js/history)]
(push-state js/history nil "test" "/ui/test"))
But I get the same TypeErrorhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Function/bind
This would be:
(let [push-state (.-pushState js/history)]
(.bind push-state js/history)
(push-state nil "test" "/ui/test"))
But still the same TypeError 😞Look carefully at this line in the example there:
const boundGetX = unboundGetX.bind(module);
Got it!
(let [push-state (.-pushState js/history)
push-state (.bind push-state js/history)]
(push-state nil "test" "/ui/test?hey"))
Thank you!Why will this code in in repl but not a LET block? (Math/floor (float (/ (.now js/Date) 1000)))
I think there was a problem with the / fn name? this code worked: (js/Math.floor (divide (.now js/Date) 1000))
(reg-event-fx
::process-token-handler
(fn-traced [cofx [_ result]]
(let [db (:db cofx)
now-secs (js/Math.floor (divide (.now js/Date) 1000))
expires-time (get-in db [:auth :session :expires])]
{:db (-> db (update-in [:auth :session] { :expires expires-time})
(assoc-in [:auth :session] {:issued-at now-secs}))
:dispatch [::events/navigate :homepage]
::events/timeout {:id :token-refresh :event [:refresh-token] :time (- 3540 (- now-secs expires-time))}})))
This code worked(reg-event-fx
::process-token-handler
(fn-traced [cofx [_ result]]
(let [db (:db cofx)
now-secs (js/Math.floor (/ (.now js/Date) 1000))
expires-time (get-in db [:auth :session :expires])]
{:db (-> db (update-in [:auth :session] { :expires expires-time})
(assoc-in [:auth :session] {:issued-at now-secs}))
:dispatch [::events/navigate :homepage]
::events/timeout {:id :token-refresh :event [:refresh-token] :time (- 3540 (- now-secs expires-time))}})))
This code yielded a null pointer exception in Cursivewhat do you mean “in Cursive”? in the build watch for this code? or Cursive is showing some exception when trying to analyze the code?
Yeah, its a special namespace, I stuck with js/Math just so its a little more consistent with other top-level interop things like js/Date
It's more consistent with JS but also not consistent with Java, where it would also be Math/floor
. But doesn't matter if your code is only for CLJS.
Anyone here use Orgpad's volcano? https://github.com/OrgPad-com/volcano
I've made a simple static site, and I want one of the pages to be a SPA, but it is not clear to me how to go about that.
The only tidbit I could find was this part of the readme:
> :routes
- A https://github.com/juxt/bidi describing the routes on your web. Not all routes have to be used by static pages, so you can easily link your static websites to your SPA.
To be clear, I want one of the the pages to still be using ClojureScript in the production build, whereas the rest of the pages are compiled down to plain HTML.
Has anyone seen these errors when using material UI with shadow?
I installed it with yarn add @mui/material @emotion/react @emotion/styled
in the root of my project, did
(ns foo.bar
(:require
["@mui/material" :as mat]))
, then compiled and went to the browser, where the console reports these errors (among others):
An error occurred when loading module$node_modules$$mui$material$node$CircularProgress$CircularProgress.js main.js:1560:15
goog.globalEval@http://localhost:3000/js/main.js:495:12
SHADOW_ENV</env.evalLoad@http://localhost:3000/js/main.js:1558:12
@http://localhost:3000/js/main.js:2210:12
main.js:1561:15
An error occurred when loading module$node_modules$$mui$material$node$LinearProgress$LinearProgress.js main.js:1560:15
goog.globalEval@http://localhost:3000/js/main.js:495:12
SHADOW_ENV</env.evalLoad@http://localhost:3000/js/main.js:1558:12
@http://localhost:3000/js/main.js:2313:12
main.js:1561:15
An error occurred when loading module$node_modules$$mui$material$node$Skeleton$Skeleton.js main.js:1560:15
goog.globalEval@http://localhost:3000/js/main.js:495:12
SHADOW_ENV</env.evalLoad@http://localhost:3000/js/main.js:1558:12
@http://localhost:3000/js/main.js:2399:12
What is the very first error? Or at least an error that says something - the errors in your snippet just tell that there's some error without actually telling what the error is.
That’s the very first one in the console. There’s this one that came last:
shadow$provide.module$node_modules$$mui$material$node$ButtonBase$TouchRipple@js/cljs-runtime/module$node_modules$$mui$material$node$ButtonBase$TouchRipple.js:23:21
shadow.js.jsRequire@js/cljs-runtime/shadow.js.js:34:18
shadow$provide.module$node_modules$$mui$material$node$ButtonBase$ButtonBase@js/cljs-runtime/module$node_modules$$mui$material$node$ButtonBase$ButtonBase.js:5:467
shadow.js.jsRequire@js/cljs-runtime/shadow.js.js:34:18
shadow$provide.module$node_modules$$mui$material$node$ButtonBase$index@js/cljs-runtime/module$node_modules$$mui$material$node$ButtonBase$index.js:4:143
shadow.js.jsRequire@js/cljs-runtime/shadow.js.js:34:18
shadow$provide.module$node_modules$$mui$material$node$AccordionSummary$AccordionSummary@js/cljs-runtime/module$node_modules$$mui$material$node$AccordionSummary$AccordionSummary.js:4:379
shadow.js.jsRequire@js/cljs-runtime/shadow.js.js:34:18
shadow$provide.module$node_modules$$mui$material$node$AccordionSummary$index@js/cljs-runtime/module$node_modules$$mui$material$node$AccordionSummary$index.js:2:336
shadow.js.jsRequire@js/cljs-runtime/shadow.js.js:34:18
shadow$provide.module$node_modules$$mui$material$node$index@js/cljs-runtime/module$node_modules$$mui$material$node$index.js:38:349
shadow.js.jsRequire@js/cljs-runtime/shadow.js.js:34:18
shadow.js.require@js/cljs-runtime/shadow.js.js:59:20
@js/cljs-runtime/mccrossin.pages.js:2:60
goog.globalEval@http://localhost:3000/js/main.js:495:12
SHADOW_ENV</env.evalLoad@http://localhost:3000/js/main.js:1558:12
@http://localhost:3000/js/main.js:2736:12
Sure, here it is:
Ah, huh, alright - so apparently shadow-cljs simply does not report such errors in full. I created https://github.com/thheller/shadow-cljs/issues/936 As to your actual issue - two things: • Try to set your browser to break on all exceptions, including the caught ones, and see what it gives you. Note that some of them might be false positives because exception throwing is sometimes used in contexts where it's not considered an error • If that doesn't give you any info, create a minimal reproducible example - I will take a look at it.
I went into chrome to break on exceptions like you suggested, and got some different errors. Not sure if these are more helpful:
> _system.keyframes is not a function
Add :compiler-options {:output-feature-set :es5}
to the shadow-cljs build config.
@U01RN86SL90 Just to get more details about what you saw initially - it was in Firefox, right?
Ah, I guess no need - https://github.com/thheller/shadow-cljs/issues/936 was just fixed. :)
hi @U2FRKM4TW I was excited to see this - unfortunately it hasn't solved my issue. I'm not really a UI guy so accept I might be doing something really stupid
I get the following error after upgrading to mui5
app.js?BUILD_VERSION:1552 TypeError: _system.keyframes is not a function
at Object.shadow$provide.module$node_modules$$mui$material$node$ButtonBase$TouchRipple (TouchRipple.js:64)
at shadow.js.jsRequire (js.js:66)
at Object.shadow$provide.module$node_modules$$mui$material$node$ButtonBase$ButtonBase (ButtonBase.js:35)
at shadow.js.jsRequire (js.js:66)
at Object.shadow$provide.module$node_modules$$mui$material$node$ButtonBase$index (index.js:32)
at shadow.js.jsRequire (js.js:66)
at Object.shadow$provide.module$node_modules$$mui$material$node$Button$Button (Button.js:29)
at shadow.js.jsRequire (js.js:66)
at Object.shadow$provide.module$node_modules$$mui$material$node$Button$index (index.js:25)
at Object.shadow.js.jsRequire (js.js:66)
I've added the compiler option to the build config - but no joy
is there a good way to check if that compiler option has taken effect ? i.e. that I have configured it properly
aha 😄 gotcha
that will explain it then
I see quite a few people with this issue with mui5 and no solutions so far
I realise it's probably not a shadow issue as such
OK - as expected, I was being a bit thick - we have a build setup with lein-shadow
so I needed to regen my shadow-cljs.edn
What do you mean no solutions? The compiler option works for me, and at least for one other person.
yes me being dim sorry