This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-31
Channels
- # beginners (153)
- # cider (30)
- # cljs-dev (8)
- # cljsrn (8)
- # clojure (105)
- # clojure-dev (6)
- # clojure-dusseldorf (5)
- # clojure-italy (6)
- # clojure-nl (3)
- # clojure-russia (34)
- # clojure-spec (23)
- # clojure-uk (54)
- # clojurescript (104)
- # core-matrix (3)
- # crypto (1)
- # cursive (17)
- # datomic (90)
- # duct (13)
- # editors (5)
- # emacs (1)
- # events (1)
- # figwheel-main (9)
- # fulcro (54)
- # hoplon (18)
- # hyperfiddle (2)
- # jobs-rus (1)
- # lein-figwheel (5)
- # leiningen (3)
- # luminus (52)
- # mount (6)
- # off-topic (22)
- # other-languages (3)
- # parinfer (7)
- # powderkeg (3)
- # re-frame (52)
- # reagent (58)
- # rum (4)
- # shadow-cljs (49)
- # spacemacs (12)
- # sql (13)
- # tools-deps (2)
- # yada (1)
so say I am in a macro and I use backtick
it seems like it cannot resolve js-obj
I have to use the fully qualified cljs.core/js-obj
, is this expected or an issue I can raise?
ok thanks 😉
hi guys
https://github.com/aibrahim/user_management this is a demo for login/signup users demo, i have problem with after login when refresh the page i lost the session and get login page again
before using it you need to create database, username owned the db with password,
i can't figure this out, please if someone can help in it, i appreciate
@abdullahibra when browser refresh happens, it loads all javascript files again, which means that you end up in initial state
(def app-state (reagent/atom {}))
(def pages (reagent/atom {:current nil}))
will the session lost also?
my session on the server, so i need to handle client to keep logged in even after reloading the page
Ok, se your server knows that the client is logged in, so after refresh you have to call the server and ask it “is this user logged in” and then render the ui accordingly
via rest API ?
what is the most secure way to do it?
I suggest that you look up a a few templates that does that for you and study the implementation.
which templates?
For example luminus
is a framework that has variety of options how to deal with authentication. You can generate a working skeleton project using leiningen templates https://github.com/luminus-framework/luminus-template
actually my project is created using luminus +auth
By quick check it seems like luminus sessions uses in-memory solution to store the sessions on server side. Anyways, if you just refresh the browser it shouldn’t affect the server. Unless your frontend code does some ajax calls to the server on initialization that can invalidate the session.
So my guess is that it’s a frontend issue and you probably need to add some kind of way to check if the user is logged in or not, that survives the browser refresh. Most common options for this are a) request from backend b) cookies c) browser local-storage
Hi Guys! Does anyone here have an example cljs code of any UI/Web App written using metosin/vega-tools
or yieldbot/vizard
? Thanks.
I currently have my entry point setup like so:
(defn ^{:export true
:dev/after-load true}
start! []
(load!)
(t/info "Started"))
(start!)
I need to set :dev/after-load true
so that it will re-start my application when I modify another ns, but I also need to put the start!
at the end in order for it to start my application when the page loads
however what this means is that when I modify the entrypoint, my start!
fn triggers twice
@lilactown create an init! function instead and call it from HTML. see https://github.com/shadow-cljs/quickstart-browser/blob/master/src/starter/browser.cljs#L7-L12
@thheller I did that at first, but then I wanted to have my entrypoint <script> async
I spent a couple hours trying to detect when the script loaded, then call init! but eventually gave up and went back to just calling start!
at the bottom
ah totally forgot. in shadow-cljs you can set :modules {:foo {:init-fn some.ns/start!}}
as well (instead of :entries
or in addition to). that will only be called once.
I'm thinking of checking goog.DEBUG, but am worried that the clojure.spec.test.alpha NS will still get bundled
Is there any way to turn of cljs devtools at runtime? I looked at all the configuration doc and it is copious but seems to assume I am a heavy-duty cljs-devtools user.
Just curious what setup you have with your REPLs and editors. Do you keep your Clojure and Clojurescript REPLs separate?
I'm using Atom, and I wrote a plug-in to work with multiple REPLs. It's not perfect yet, but it works most of the time
What I use is Figwheel with Sidecar, then I start figwheel inside nREPL and use Atom to connect to it (with clojure-plus and proto-repl). Works most of the time, it's just kinda slow to evaluate CLJS code
@thiru0130 you run cljs REPL in clj REPL. Tell people what editor you use, this will help to help you 🙂 Also it looks different depend on you use lein
vs shadow-cljs
or figwheel
vs something else.
editors: cursive intellij vs emacs. I can recommend this 2. Others are not enough mature IMO.
Would someone remind me if there's a cljs equivalent to clojure.main/repl
, ie a way to start a cljs repl from within cljs? Finding it hard to google for, and not immediately finding it in the cljs source code.
Huh. I see a repl
fn in src/main/clojure/cljs/repl.cljc
, not wrapped in a reader conditional, which would make me think I could call it, but I seem to be unable to.
@eggsyntax I'm assuming you are in self host environment?
Added a simple animation to the tau.alpha demo to give a better idea of the screen lag: https://johnmn3.github.io/tau.alpha/ Also, question: Where would folks prefer a tau's (atom-like thing, shared between web-workers) watcher fns fire off? On the worker that last updated the tau? Or the worker that created the tau? Or the worker that added the watch-fn to the tau? Or should there be a subscription mechanism from any worker to specific watch keys? The semantics differ slightly from CLJ because most state in each worker is not shared between them, and only the screen thread has access to certain functions like those in js/document.
Interesting that the fn throws as undefined, since it's in a cljc file. Issue with the source path not being present, maybe?
Was rewatching Stu's repl-driven development talk & he was mentioning the way to create a macro that would give you the classic break-to-repl functionality, and I was idly wondering if I could make that work in cljs as well.
I don't typically mess with anything deeply along these lines on the cljs side, only in clj.
Very! Just accepted a job offer last night from these folks, and I'm pretty psyched about it 😄 😄 😄 https://democracy.works
@bhauman Just throwing it out there if you'd be willing to come to Toronto we have a job opening for a senior dev. We're mostly C# but I've been bringing in Clojure slowly. And our team has 20% time.. potentially more in the future 🙂
Would you consider it if it were remote? We have some on our team but boss prefers local. But for a dev of your calibre we can definitely consider I think
I'm not a total noob. I've been using (JVM) Clojure for a few months but trying to add in CLJS now
I've had Vim + vim-fireplace + nREPL + tools.deps working good for that. But now adding CLJS I'm not so sure how to easily fit it in
The new tool in my chain really just being Figwheel. Right now I'm running Clojure and ClojureScript REPLs in two different terminals (which I don't mind)... but how to connect both terminals to a single vim-fireplace?
@thiru0130 I don't use vim or vim fireplace
start a Clojure nREPL from VIM like usual, if you only know how to do this wil lein then I reccomend that you use figwheel.main from lein for now to get started
make sure you have piggieback in your dependencies then call (figwheel.main/start "dev")
if dev
is your build name
Thanks @bhauman - so I got that far and I can communicate to Vim in CLJ and CLJS code.. but how can I switch back to the CLJ repl in the terminal? It seems that once I run (figwheel.main/start "dev")
I'm stuck in CLJS land?
Is it possible to do this, or would I have to have two separate REPL/terminal instances?