This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-19
Channels
- # announcements (9)
- # babashka (11)
- # beginners (157)
- # calva (10)
- # cider (18)
- # clara (4)
- # clj-kondo (40)
- # cljsrn (8)
- # clojure (29)
- # clojure-europe (11)
- # clojure-italy (1)
- # clojure-nl (2)
- # clojure-spec (4)
- # clojure-sweden (1)
- # clojure-uk (39)
- # clojurescript (32)
- # conjure (1)
- # core-async (2)
- # cursive (20)
- # datomic (7)
- # duct (9)
- # emacs (1)
- # figwheel-main (1)
- # fulcro (24)
- # helix (1)
- # hoplon (20)
- # hugsql (3)
- # jackdaw (5)
- # jobs-discuss (7)
- # lambdaisland (1)
- # malli (5)
- # music (4)
- # off-topic (54)
- # parinfer (2)
- # pedestal (13)
- # re-frame (12)
- # reagent (22)
- # reitit (9)
- # shadow-cljs (89)
- # spacemacs (2)
- # xtdb (21)
Hello! I am trying to use the react-bootstrap-table2 ’Export CSV’ functionality and struggling with the dependencies syntax - specifically, how to require ToolkitProvider, CSVExport, and ExportCSVButton. Any tips? import ToolkitProvider, { CSVExport } from 'react-bootstrap-table2-toolkit'; const { ExportCSVButton } = CSVExport;
see the translation table here https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages
Thank you. Doing the following gets me access to ToolkitProvider
and CSVExport
but I’m not sure how to get ExportCSVButton
out of CSVExport
.
["react-bootstrap-table2-toolkit" _:refer_ (CSVExport) _:default_ ToolkitProvider]
I'm trying to work on a react native app on an android device via USB but having a lot of trouble. I've disabled fast refresh and don't see an option for live reload or hot code reload in the debug menu. I'm on the latest shadow-cljs release (2.10.12) The app is able to load and make requests to my laptop. But whenever I update some code the app crashes instead of refreshing. If I try connecting to the app's repl I get this (using intelliJ)
Connecting to remote nREPL server...
Clojure 1.10.1
(shadow/repl :pos-bare)
To quit, type: :cljs/quit
=> [:selected :pos-bare]
1
The previously used runtime disappeared. Will attempt to pick a new one when available but your state might be gone.
In the build section I see the connected runtimes keep getting droped and new ones are created.
The logs are also consistent
#17 ready!
#18 ready!
#19 ready!
#21 ready!
Any idea what would cause the connected runtimes to keep getting dropped like that?
Also this same code works on my friend's laptop so seems like something specific to my setup.just verified, repl connecting to an emulator works fine it's just the device that's broken
also verified i can make requests from the device to the server, but for some reason the runtimes still get dropped
(js/setInterval #(async/go
(let [response (async/<! (http/get ""))]
(log/spy :warn response)))
1000)
I also followed the instructions here, with the --verbose
option i see the ip address is correct and in react-native log-android
I don's see anything informative about why the runtime is getting dropped. Just the following
[20:23:16] I | ReactNativeJS ▶︎ #8 ready!
[20:23:39] I | ReactNativeJS ▶︎ #9 ready!
[20:24:05] I | ReactNativeJS ▶︎ #10 ready!
[20:24:28] I | ReactNativeJS ▶︎ #11 ready!
[20:24:52] I | ReactNativeJS ▶︎ #12 ready!
https://shadow-cljs.github.io/docs/UsersGuide.html#repl-trouble-react-native@currentoor that looks odd but the timing appears to be the ping/pong timeout
i wounder if perhaps i have a defective device
i tried connecting a websocket from device to my laptop and it kept dropping and re-establishing the connection
that said, why does shadow establish a new runtime every time instead of re-connecting the old one?
if the runtime doesn't respond to pings for about ~20sec it will be kicked by the relay
the relay is sending a ping every 5sec when idle and the runtime is supposed to respond
you can try setting :log {:level :debug}
in shadow-cljs.edn
but that will likely just confirm that it is indeed kicking because of ping timeout
o/ 'lo there I'm writing a custom target for a resource constrained environment and am trying to figure out the proper compiler options to enable dead code elimination, but disable renaming and whitespace removal. So the code remains readable, but dead code is removed.
I suspect if I could get a hold of the underlying CompilerOptions
object, I could call setRemoveDeadCode(true)
on it when using optimizations :none
I'm writing a target for the game http://screeps.com
The code players right is ES6, but not in a DOM nor a node-like environment. I started with the graaljs target, and customized it. However there is a 2MB code limit on player code, and just cljs+goog is 1.5MB.
No ESM support unfortunately. It supports a limited require
that has no support for folders.
compile
might work for that one but you'll be approaching the size limits pretty fast
Yea, I got it working at first with :node-library
(or was it node script? don't remember), in dev and release modes. But in this game you'll need to react on the fly to things happening in the world, and it is very useful to see the un-minified code. You'll often react to some event in game by patching the deployed code, then later bringing those changes back into your codebase.
hmm does it support websockets? might be fun to get in there and use the REPL to tune stuff 😛
the official game doesn't, but, since its open source, i'm working on a patch to the server to allow WS. That would be useful for testing outside the main official server.
getting a repl is one of my goals, it would be tons of fun (even if not on the main server)
:simple
with just cljs.core is about 1mb. not sure how much code the game code ends up being but that might be fine?
:target :esm
would be by far the best option for this .. shame they don't support it 😛
devtools_page
in the manifest needs to point to an .html page, so I generate an ESM module and then manually include it in that .html page?
@thheller Just tried the shadow’s Inspect feature — works great! Thank you :star-struck:
Hello, how do I include dependencies for specific builds? e.g. I want to add re-frisk
to my :dev
build, but not in my :prod
build?
@thheller not sure how to debug this, but I think there may be some kind of race-condition bug. With the newest `malli.registry/type` code (that checks for a setting via closure-defines), once in a while (but only after a shadow-server restart) I see the `{:type "default"}` exception (i.e. a missing closure-defines
option), but it Just Works™ if I "force compile" the build once in the shadow UI.
which is dependent on this: https://github.com/metosin/malli/blob/master/src/malli/registry.cljc#L4
so, it looks like (goog-define type "default")
is returning "default"
- malli will throw an exception; then I "force compile", type is no longer "default"
but "custom"
and malli continues without errors
where I'm setting in shadow-cljs.edn: :closure-defines {malli.registry/type "custom"}
there is some kind of bug that I haven't figured out when switching between compile->watch
maybe thats also present in watch->watch. I have no clue what is happening but it results in a compile error. so unlikely to be related to your problem
ok, it's not a showstopper 🙂 If I figure out how to reproduce it I'll post an issue. Cheers!
for now I've only seen it when starting server -> first watch; (if that helps narrow it down)
Hello, I have some trouble with the shadow-cljs modules: I have a google closure error saying 1. Do you know what this would be?
oh I think I got it, there is an error in cljs.spec.alpha when calling gen...
@kevin.van.rooijen classpath doesn't matter just always include it. and then add re-frisk via :preloads
.
@ramblurr only https://shadow-cljs.github.io/docs/UsersGuide.html#repl-troubleshooting
> The goog:
prefix currently only works for ES6 file. require("goog:cljs.core")
does not work.
There's no way to call cljs from js then when ESM isn't available?
re the repl docs: that is a nice high level explanation. To implement a repl for screeps, I'd need to be able to implement #3 Transfer Out and #6 Transfer Back using something besides web sockets... vanilla http requests
It is unlikely that you need to implement that since there already is an impl for websockets
There are no websockets. from inside the game i can read/write json to a memory location, from outside the game I can read/write to that memory location using an HTTP GET/POST.
https://github.com/thheller/shadow-cljs/blob/master/doc/remote.md this might also be relevant