@lilactown any ideas?
not without more info
in the earlier form of this I think that the full error message was relevant
JSON value '{
nonceEnabled = 1;
requestedOperation = 1;
requestedScopes = (
"<null>",
1
);
}' of type NSMutableDictionary cannot be converted to ASAuthorizationAppleIDRequest *
you see requestScopes = ( "<null>"
which isn't a valid member of the enum on the iOS sidemy best guess is you're still passing something incorrect to it
Good Morning Clojurians, I am doing some cljs with shadow-cljs and my main.js
file is 20 mega bytes and every time I update something it takes 30 seconds to re-compile, is that normal for cljs?
@simongray my shadow-cljs.edn file:
{:deps {:aliases [:dev]}
:nrepl {:port 9000}
:builds {:main {:target :browser
:output-dir "resources/public/js/main"
:asset-path "/js/main"
:modules {:main {:init-fn app.client/init}}
;; guardrails checks only during dev
:dev {:compiler-options
{:external-config
{:guardrails {:emit-spec? true :throw? false}}}}
:devtools {:after-load app.client/refresh
:preloads [com.fulcrologic.fulcro.inspect.preload app.development-preload]}}
:test {:target :browser-test
:test-dir "resources/public/js/test"
:ns-regexp "-test$"
;; static required for mocking to work
:compiler-options {:static-fns false
:external-config {:guardrails {:throw? true}}}
:devtools {:http-port 8022
:http-resource-root "public"
:http-root "resources/public/js/test"}}
:ci-tests {:target :karma
:js-options {:js-provider :shadow}
:compiler-options {:static-fns false
:external-config {:guardrails {:throw? true}}}
:output-to "target/ci.js"
:ns-regexp "-test$"}
:workspaces {:target nubank.workspaces.shadow-cljs.target
:ns-regexp "-(test|ws)$"
:output-dir "resources/public/workspaces/js"
:asset-path "/workspaces/js"
:devtools {:preloads [com.fulcrologic.fulcro.inspect.preload]
:http-root "resources/public/workspaces"
:http-port 8023
:http-resource-root "."}}}}
@timofey.sitnikov If 20MB is the release build, then you can use this to understand what inflates the bundle: https://shadow-cljs.github.io/docs/UsersGuide.html#build-report
No, 20 mb is development build.
Then it's perfectly normal.
Too few details.
20MB should be normal during development if you use a lot of and/or heavy third-party libraries (probably NPM). But it's not normal for a release bundle.
30 seconds is normal for a release build or for the initial debug build. It's not normal to wait 30 seconds for an incremental compilation step during watch
.
try #shadow-cljs and post your shadow-cljs.edn file
Hi!
I think I had confirmation that a dynamic import/require
like in this example is not possible in CLJS (browser).
const app = document.getElementById('app');
render(
<InertiaApp
initialPage={JSON.parse(app.dataset.page)}
resolveComponent={name =>
import(`./Pages/${name}`).then(module => module.default)
}
/>,
app
);
Someone would have an idea of an alternative solution?
I would like to avoid calling Reagent components one by one by hand and have the same level of automatism as in the example given.For now, here's how I do it.
(ns myreagent.core
(:require ["@inertiajs/inertia-react" :refer [App]]
[myreagent.pages.home :refer [Home]]
[myreagent.pages.demo :refer [Demo]]
[reagent.core :as r]
[reagent.dom :as d]))
(def el (.getElementById js/document "app"))
(defn home-page []
[:> App {:initial-page (.parse js/JSON (.. el -dataset -page))
:resolve-component (fn [name] (r/reactify-component (case name
"Home" Home
"Demo" Demo)))}])
(defn mount-root []
(d/render [home-page] el))
(defn ^:export init! []
(mount-root))
Module splitting, probably. But use it sparsely and only for isolated chunks of functionality. I.e. there's very little reason to split the main page with 10 panels into 10 modules if all the panels will be displayed at the same time unconditionally anyway.
I'm having trouble using shadow-cljs. I have a basic build:
{:fn {:target :node-library
:compiler-options {:infer-externs :auto}
:output-to "functions/index.js"
:exports-var functions.fn/exports}}
Yet it complains required namespace "functions.fn" is not available
but I have src/functions/fn.cljs
with:
(ns functions.fn
(:require ["firebase-functions" :as functions]
["firebase-admin" :as admin]))
(defonce init (.initializeApp admin))
(defn echo [req res]
(js/console.log req res))
(def exports
#js {:echo (.onCall functions/https echo)})
src/main/functions/fn.cljs
Should't transit save metadata?
(write-transit (with-meta {:a 1} {:b 2}))
;; => "[\"^ \",\"~:a\",1]"
(meta (read-transit (write-transit (with-meta {:a 1} {:b 2}))))
;; => nil
no, transit does not preserve metadata
; (
it's designed to be language agnostic and that's not a feature generally available
You can add support to preserve metadata https://github.com/djblue/portal/blob/master/src/portal/runtime/transit.cljs#L32-L59 is how I did it
I found such a line in the code and I was convinced that it saves metadata https://github.com/cognitect/transit-cljs/blob/master/src/cognitect/transit.cljs#L195
The key is :transform write-meta
thx!
looks like maybe the transit-clj / transit-cljs libs do have an optional transform for it
https://github.com/cognitect/transit-clj/blob/700f205781df180c3b4b251341e7f1831f9f71cb/test/transit/test_with_meta.clj#L29-L37 is a transit-clj test using it
If you are also using transit-clj, watch out for this issue https://github.com/cognitect/transit-clj/issues/47
in transit-cljs, http://cognitect.github.io/transit-cljs/cognitect.transit.html#var-writer takes a :transform, and write-meta is an available transform
so, I take it back, it does support it (if asked)!
@djblue already told me this solution in the thread
awesome!
metadata is probably one of the most underrated feature
Especially with how you can implement protocols via metadata!
I haven't tried this yet, but it sounds great.
It's particularly useful for implementing clojure.core.protocols/nav
on your https://github.com/djblue/portal/blob/master/src/examples/hacker_news.cljc#L76-L80 which allows tools to help you navigate through your data.